summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2023-12-05 15:52:49 +0000
committerErik Johnston <erik@matrix.org>2023-12-05 15:52:49 +0000
commit9583a061785f94898c051986f3a2e9e8588878be (patch)
tree3eed655ac5a3316c0c1cc7f4375a056f71ed6e31 /synapse/handlers
parentMerge remote-tracking branch 'origin/develop' into matrix-org-hotfixes (diff)
parentFix upgrading a room without `events` field in power levels (#16725) (diff)
downloadsynapse-9583a061785f94898c051986f3a2e9e8588878be.tar.xz
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/profile.py10
-rw-r--r--synapse/handlers/room.py2
2 files changed, 9 insertions, 3 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py

index 1027fbfd28..e043fd5322 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py
@@ -129,6 +129,7 @@ class ProfileHandler: new_displayname: str, by_admin: bool = False, deactivation: bool = False, + propagate: bool = True, ) -> None: """Set the displayname of a user @@ -138,6 +139,7 @@ class ProfileHandler: new_displayname: The displayname to give this user. by_admin: Whether this change was made by an administrator. deactivation: Whether this change was made while deactivating the user. + propagate: Whether this change also applies to the user's membership events. """ if not self.hs.is_mine(target_user): raise SynapseError(400, "User is not hosted on this homeserver") @@ -188,7 +190,8 @@ class ProfileHandler: target_user.to_string(), profile, by_admin, deactivation ) - await self._update_join_states(requester, target_user) + if propagate: + await self._update_join_states(requester, target_user) async def get_avatar_url(self, target_user: UserID) -> Optional[str]: if self.hs.is_mine(target_user): @@ -221,6 +224,7 @@ class ProfileHandler: new_avatar_url: str, by_admin: bool = False, deactivation: bool = False, + propagate: bool = True, ) -> None: """Set a new avatar URL for a user. @@ -230,6 +234,7 @@ class ProfileHandler: new_avatar_url: The avatar URL to give this user. by_admin: Whether this change was made by an administrator. deactivation: Whether this change was made while deactivating the user. + propagate: Whether this change also applies to the user's membership events. """ if not self.hs.is_mine(target_user): raise SynapseError(400, "User is not hosted on this homeserver") @@ -278,7 +283,8 @@ class ProfileHandler: target_user.to_string(), profile, by_admin, deactivation ) - await self._update_join_states(requester, target_user) + if propagate: + await self._update_join_states(requester, target_user) @cached() async def check_avatar_size_and_mime_type(self, mxc: str) -> bool: diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index f865bed1ec..2823ca6f0d 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py
@@ -549,7 +549,7 @@ class RoomCreationHandler: except (TypeError, ValueError): ban = 50 needed_power_level = max( - state_default_int, ban, max(event_power_levels.values()) + state_default_int, ban, max(event_power_levels.values(), default=0) ) # Get the user's current power level, this matches the logic in get_user_power_level,