diff options
author | Travis Ralston <travisr@matrix.org> | 2023-12-04 04:36:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 11:36:12 +0000 |
commit | d6e194b2bc1b71c04d55617359b43f4dde5bc593 (patch) | |
tree | 0e1aab46285d27097e1441e4e739443818a4d6d0 /synapse/handlers/profile.py | |
parent | Bump idna from 3.4 to 3.6 (#16720) (diff) | |
download | synapse-d6e194b2bc1b71c04d55617359b43f4dde5bc593.tar.xz |
Implement MSC4069: Inhibit profile propagation (#16636)
MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4069
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r-- | synapse/handlers/profile.py | 10 |
1 files changed, 8 insertions, 2 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: |