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.
This commit is contained in:
Mathieu Velten 2020-11-30 19:59:29 +01:00 committed by GitHub
parent f8d13ca13d
commit 9f0f274fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

1
changelog.d/8799.bugfix Normal file
View File

@ -0,0 +1 @@
Allow per-room profiles to be used for the server notice user.

View File

@ -346,7 +346,15 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
# later on. # later on.
content = dict(content) 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 # 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 # event's content in event_creation_handler.create_event() using the target's
# global profile. # global profile.