Skip to content

Commit 4125a60

Browse files
committed
Merge branch 'dev'
2 parents 5ccdb64 + 5c49cb3 commit 4125a60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/backend/lib/group/digest2/personalizeData.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ const filterMyAndBlockedUserData = async (userId, data) => {
7272
if (key === 'posts_with_new_comments' && object.comments.length === 0) return null
7373

7474
// Filter out chats that are older than the most recently read chat in that room by this user
75+
// Also dont show chats in chat rooms that the user is not following
7576
if (key === 'chats') {
7677
if (!chatRooms[object.topic_name]) {
7778
const tag = await Tag.where({ name: object.topic_name }).fetch()
7879
chatRooms[object.topic_name] = await TagFollow.where({ tag_id: tag.id, group_id: data.group_id, user_id: userId }).fetch()
7980
}
80-
if (object.id <= chatRooms[object.topic_name].get('last_read_post_id')) return null
81+
if (!chatRooms[object.topic_name] || object.id <= chatRooms[object.topic_name].get('last_read_post_id')) return null
8182
}
8283
return object
8384
}))

0 commit comments

Comments
 (0)