diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-05-25 11:07:21 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-05-25 11:07:21 +0100 |
commit | 757ed2725803ff6d190eb1bb8dea872345862aa3 (patch) | |
tree | 79f0fbaa23945c4ca188d2c1a8f7158b62aece6f /synapse/handlers/room_member.py | |
parent | Merge branch 'release-v0.30.0' into develop (diff) | |
download | synapse-757ed2725803ff6d190eb1bb8dea872345862aa3.tar.xz |
Let users leave the server notice room after joining
They still can't reject invites, but we let them leave it.
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r-- | synapse/handlers/room_member.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 82adfc8fdf..f930e939e8 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -298,16 +298,6 @@ class RoomMemberHandler(object): is_blocked = yield self.store.is_room_blocked(room_id) if is_blocked: raise SynapseError(403, "This room has been blocked on this server") - else: - # we don't allow people to reject invites to, or leave, the - # server notice room. - is_blocked = yield self._is_server_notice_room(room_id) - if is_blocked: - raise SynapseError( - http_client.FORBIDDEN, - "You cannot leave this room", - errcode=Codes.CANNOT_LEAVE_SERVER_NOTICE_ROOM, - ) if effective_membership_state == Membership.INVITE: # block any attempts to invite the server notices mxid @@ -383,6 +373,20 @@ class RoomMemberHandler(object): if same_sender and same_membership and same_content: defer.returnValue(old_state) + # we don't allow people to reject invites to the server notice + # room, but they can leave it once they are joined. + if ( + old_membership == Membership.INVITE and + effective_membership_state == Membership.LEAVE + ): + is_blocked = yield self._is_server_notice_room(room_id) + if is_blocked: + raise SynapseError( + http_client.FORBIDDEN, + "You cannot reject this invite", + errcode=Codes.CANNOT_LEAVE_SERVER_NOTICE_ROOM, + ) + is_host_in_room = yield self._is_host_in_room(current_state_ids) if effective_membership_state == Membership.JOIN: |