Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-lions-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fixes the possibility of see new messages without being subscribed to a public channel.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export class NotificationsModule {
}

const canAccess = await Authorization.canAccessRoom(room, { _id: this.userId || '' }, extraData);
Comment thread
tiagoevanp marked this conversation as resolved.
Outdated

if (!canAccess) {
// verify if can preview messages from public channels
if (room.t === 'c' && this.userId) {
Expand All @@ -110,6 +111,16 @@ export class NotificationsModule {
return false;
}

if (room.t === 'c' && this.userId) {
if (await Authorization.hasPermission(this.userId, 'preview-c-room')) {
const subscription = await Subscriptions.findOneByRoomIdAndUserId(room._id, this.userId);

return !!subscription;
}

return false;
Comment thread
tiagoevanp marked this conversation as resolved.
Outdated
}

return true;
});

Expand Down