Fix corrupted member_cache entries on invite

This commit is contained in:
Cadence Ember 2023-10-12 15:49:57 +13:00
parent dc92dc0b69
commit 166ac447a8
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
BEGIN TRANSACTION;
DELETE FROM member_cache;
COMMIT;

View file

@ -147,6 +147,6 @@ sync.addTemporaryListener(as, "type:m.room.member", guard("m.room.member",
*/ */
async event => { async event => {
if (event.state_key[0] !== "@") return if (event.state_key[0] !== "@") return
if (utils.eventSenderIsFromDiscord(event.sender)) return if (utils.eventSenderIsFromDiscord(event.state_key)) return
db.prepare("REPLACE INTO member_cache (room_id, mxid, displayname, avatar_url) VALUES (?, ?, ?, ?)").run(event.room_id, event.sender, event.content.displayname || null, event.content.avatar_url || null) db.prepare("REPLACE INTO member_cache (room_id, mxid, displayname, avatar_url) VALUES (?, ?, ?, ?)").run(event.room_id, event.state_key, event.content.displayname || null, event.content.avatar_url || null)
})) }))