Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Allow per-room profile to be used for server notice user
Browse files Browse the repository at this point in the history
This applies even if the feature is disabled at the server level.
The server notice not being a real user it doesn't have an user profile.

Signed-off-by: Mathieu Velten <matmaul@gmail.com>
  • Loading branch information
MatMaul committed Nov 23, 2020
1 parent 7127855 commit ed2c20f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/8799.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow per-room profile to be used for server notice user.
12 changes: 11 additions & 1 deletion synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,17 @@ async def update_membership_locked(
# later on.
content = dict(content)

if not self.allow_per_room_profiles or requester.shadow_banned:
is_requester_server_notice_user = False
if (
self._server_notices_mxid is not None
and requester.user.to_string() == self._server_notices_mxid
):
# allow the server notices mxid to set room-level profile
is_requester_server_notice_user = True

if (
not self.allow_per_room_profiles and not is_requester_server_notice_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.
Expand Down

0 comments on commit ed2c20f

Please sign in to comment.