-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
Description:
Certain events create messages which are displayed in the chat conversation along with user-generated messages, e.g. "User Alice added by Bob". The settings page /admin/settings/Message has a section Hide System Messages, with a multiselect of Hide “Foo” messages. When we set, for example, Hide "User Added" messages, those messages still exist in the database (and perhaps are still sent to the client?), but they are not displayed to the user.
After a recent upgrade from 4.8.4 to 5.1.2, that hiding stopped working in certain situations. It works for messages that are loaded on the initial page load or when scrolling back, but the messages are not hidden when received as part of the websocket event feed, that is, while the user is actively online in the room.
Steps to reproduce:
-
Prepare two web browsers, so we can have multiple, concurrent sessions during this exercise, logged in as two different users.
-
In browser 1, log in as an Admin
-
Go to /admin/settings/Message and add “Hide "User Added" Messages” to the “Hide System Messages” list

-
Ensure that user "A" is in a given chat room and that user "B" is not.
-
In browser 2, log in as user "A" and sit in that same chat room
-
In browser 1 (Admin), add user "B" to the chat room
-
In browser 2 (user A), notice that the "User B added by Admin" message is posted to the room.

-
In browser 2 (user A), reload the page. Notice that the "User B added by Admin" is no longer visible.

Expected behavior:
The "User B added by Admin" message should not be visible at any time, neither by users who are logged in at the time of the "au" event nor by users who enter the chatroom afterward.
Actual behavior:
The "User B added by Admin" message is (incorrectly) shown to users who are logged in at the time of the "au" event. It is (correctly) not shown to users who enter the chatroom afterward.
Server Setup Information:
- Version of Rocket.Chat Server: 5.1.2
- Operating System: Linux
- Deployment Method: tar
- Number of Running Instances: 15
- DB Replicaset Oplog: oplog Enabled
- NodeJS Version: v14.19.3
- MongoDB Version: 4.2.15 / wiredTiger (oplog Enabled)
Client Setup Information
- Desktop App or Browser Version: Chrome Version 105.0.5195.125 (Official Build) (arm64)
- Operating System: MacOS
Additional context
Recently upgraded RC from v4.8.4 to v5.1.2. We started receiving reports of this "new" notification shortly afterward.
Relevant logs:
In Chrome's developer tools, the websocket shows the following message (formatted for readability)
{
"msg": "changed",
"collection": "stream-room-messages",
"id": "id",
"fields": {
"eventName": "CLAryzmwwkidzN7fi",
"args": [
{
"_id": "QAt3GG9qWGrSBXMCr",
"t": "au",
"rid": "CLAryzmwwkidzN7fi",
"ts": {"$date": 1663837364689},
"msg": "test.user.noach.3",
"u": {
"_id": "YAs2xng29uJwjRTnx",
"username": "Seeking.Alpha"
},
"groupable": false,
"_updatedAt": {"$date": 1663837364710}
}
]
}
}