fix: filter closed DMs from WebSocket ready payload
The buildReadyPayload query fetched all dm_members rows without checking the closed flag, causing closed DMs to reappear on every page reload. The REST endpoint GET /api/dm already filtered correctly.
This commit is contained in:
@@ -1043,7 +1043,10 @@ function buildReadyPayload(userId: string): {
|
||||
// Get DM channels
|
||||
const dmMemberships = db.select()
|
||||
.from(schema.dmMembers)
|
||||
.where(eq(schema.dmMembers.userId, userId))
|
||||
.where(and(
|
||||
eq(schema.dmMembers.userId, userId),
|
||||
eq(schema.dmMembers.closed, 0),
|
||||
))
|
||||
.all();
|
||||
|
||||
const dmChannelIds = dmMemberships.map(dm => dm.dmChannelId);
|
||||
|
||||
Reference in New Issue
Block a user