element-hq / element-hq/synapse
.m.rule.contains_display_name overrides "all messages" notification option for room
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
Notifications are not received when sending a message mentioning a user when mentioning the user is disabled, even if the notification settings are marked as all messages.
That is, if I have:
GET `_matrix/client/v3/pushrules/global/override/.m.rule.contains_display_name`:
`{"conditions":[{"kind":"contains_display_name"}],"actions":[],"rule_id":".m.rule.contains_display_name","default":true,"enabled":true}`
Then notifications are not sent even if the room is enabled in "all messages" mode:
GET `/_matrix/client/v3/pushrules/global/room/`:
`{"actions":["notify",{"set_tweak":"sound","value":"default"}],"rule_id":"","default":false,"enabled":true}`
I expected that when disabling notifications when mentioning the display name, notifications in the room should still come with notification (tweak) according to the settings in the room
I think this bug is related to synapse, since the rules are checked at its level, and it also regulates sending notifications to the push gateway or something like that.
### Steps to reproduce
Follow these steps in Cinny:
- Create an account named, for example, andrew
- Create a room and enable all notifications in it (set the room to Notifications->All Messages)
- In Settings, under Notifications, under Special Messages, disable the "Contains Displayname" option (As far as I understand, this affects the push rules. m.rule.contains_display_name - it removes all actions, but even using "enabled: false" instead has the same effect)
- Send any message from another account that doesn't mention your display name
- Make sure notifications are working
- Send a message from another account that has a mention (this could even be a mention like andrew.test.net)
- The "All Messages" setting for the room is ignored and the notification doesn't arrive
### Homeserver
Private homeserver
### Synapse Version
1.143.0
### Installation Method
Docker (matrixdotorg/synapse)
### Database
PostgreSQL, single postgresql server, ported from sqlite. I once restored from a backup when the database was in SQLite format.
### Workers
Single process
### Platform
Arch Linux
Linux 6.16.8
Core i5-4200M
8GB ram
Run on real hardware, without virtualization
### Configuration
_No response_
### Relevant log output
```shell
With display name disabled:
synapse-1 | 2025-12-01 21:50:28,362 - synapse.access.http.8008 - 521 - INFO - PUT-3639 - 192.168.1.1 - 8008 - {} Processed request: 0.048sec/0.001sec (0.008sec, 0.001sec) (0.003sec/0.007sec/10) 59B 200 "PUT /_matrix/client/r0/rooms//send/m.room.message/ HTTP/1.1" "Go-http-client/1.1" [0 dbevts]
synapse-1 | 2025-12-01 21:50:28,363 - synapse.federation.sender - 648 - INFO - process_event_queue_for_federation-324 - Unexpectedly did not have cached prev group for $NcuNsBYxTuNSyC6umSuVYYeGgZ7uM21H-PpQHtaKGEc
With display name enabled:
synapse-1 | 2025-12-01 21:51:50,961 - synapse.access.http.8008 - 521 - INFO - PUT-3689 - 192.168.1.1 - 8008 - {} Processed request: 0.061sec/0.003sec (0.008sec, 0.000sec) (0.003sec/0.011sec/11) 59B 200 "PUT /_matrix/client/r0/rooms//send/m.room.message/ HTTP/1.1" "Go-http-client/1.1" [0 dbevts]
synapse-1 | 2025-12-01 21:51:50,971 - synapse.push.httppusher - 254 - INFO - httppush.process-110 - Processing 1 unprocessed push actions for starting at stream_ordering 307340
synapse-1 | 2025-12-01 21:51:50,972 - synapse.push.httppusher - 254 - INFO - httppush.process-109 - Processing 1 unprocessed push actions for starting at stream_ordering 307340
synapse-1 | 2025-12-01 21:51:50,974 - synapse.push.httppusher - 254 - INFO - httppush.process-111 - Processing 1 unprocessed push actions for starting at stream_ordering 307340
synapse-1 | 2025-12-01 21:51:50,974 - synapse.push.httppusher - 254 - INFO - httppush.process-108 - Processing 1 unprocessed push actions for starting at stream_ordering 307340
synapse-1 | 2025-12-01 21:51:51,449 - synapse.http.client - 454 - INFO - httppush.process-108 - Received response to POST https:///_matrix/push/v1/notify: 200
synapse-1 | 2025-12-01 21:51:51,510 - synapse.http.client - 454 - INFO - httppush.process-109 - Received response to POST https:///_matrix/push/v1/notify: 200
synapse-1 | 2025-12-01 21:51:51,514 - synapse.http.client - 454 - INFO - httppush.process-111 - Received response to POST https://push.fluffychat.im/_matrix/push/v1/notify: 200
synapse-1 | 2025-12-01 21:51:51,550 - synapse.http.client - 454 - INFO - httppush.process-110 - Received response to POST https://matrix.org/_matrix/push/v1/notify: 200
```
### Anything else that would be useful to know?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.