Fix and test broken room bridge check #104
2 changed files with 10 additions and 1 deletions
9
src/db/migrations/0043-clean-unbridged-member-cache.sql
Normal file
9
src/db/migrations/0043-clean-unbridged-member-cache.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
DELETE FROM member_cache
|
||||||
|
WHERE room_id NOT IN (SELECT room_id FROM channel_room)
|
||||||
|
AND room_id NOT IN (SELECT space_id FROM guild_space)
|
||||||
|
AND room_id NOT IN (SELECT room_id FROM historical_channel_room)
|
||||||
|
AND room_id NOT IN (SELECT room_id FROM invite);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
@ -422,7 +422,7 @@ async event => {
|
||||||
|
|
||||||
if (utils.eventSenderIsFromDiscord(event.state_key)) return
|
if (utils.eventSenderIsFromDiscord(event.state_key)) return
|
||||||
|
|
||||||
const exists = select("channel_room", "room_id", {room_id: event.room_id}) ?? select("guild_space", "space_id", {space_id: event.room_id})
|
const exists = select("channel_room", "room_id", {room_id: event.room_id}).pluck().get() ?? select("guild_space", "space_id", {space_id: event.room_id}).pluck().get()
|
||||||
if (!exists) return // don't cache members in unbridged rooms
|
if (!exists) return // don't cache members in unbridged rooms
|
||||||
|
|
||||||
// Member is here
|
// Member is here
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue