summary refs log tree commit diff
path: root/synapse/handlers/room_member.py
diff options
context:
space:
mode:
authorMathieu Velten <matmaul@gmail.com>2020-11-30 19:59:29 +0100
committerGitHub <noreply@github.com>2020-11-30 18:59:29 +0000
commit9f0f274fe0bd9dd6ccd7e2b53e2536cb6d02ae9b (patch)
tree3dfee7bee79eb31eb9bb35dd7564b5e01aef0931 /synapse/handlers/room_member.py
parentDrop (almost) unused index on event_json (#8845) (diff)
downloadsynapse-9f0f274fe0bd9dd6ccd7e2b53e2536cb6d02ae9b.tar.xz
Allow per-room profile to be used for server notice user (#8799)
This applies even if the feature is disabled at the server level with `allow_per_room_profiles`.
The server notice not being a real user it doesn't have an user profile.
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r--synapse/handlers/room_member.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 13a793c05a..c002886324 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -346,7 +346,15 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
             # later on.
             content = dict(content)
 
-        if not self.allow_per_room_profiles or requester.shadow_banned:
+        # allow the server notices mxid to set room-level profile
+        is_requester_server_notices_user = (
+            self._server_notices_mxid is not None
+            and requester.user.to_string() == self._server_notices_mxid
+        )
+
+        if (
+            not self.allow_per_room_profiles and not is_requester_server_notices_user
+        ) or requester.shadow_banned:
             # Strip profile data, knowing that new profile data will be added to the
             # event's content in event_creation_handler.create_event() using the target's
             # global profile.