summary refs log tree commit diff
path: root/synapse/handlers/room_member.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-04-05 11:13:24 +0100
committerErik Johnston <erik@matrix.org>2016-04-05 11:13:24 +0100
commitdf727f212606b771b1410c8e322fb8a99d159de4 (patch)
tree771a74464dda92d206316d613770b302e43c1e35 /synapse/handlers/room_member.py
parentDocs and indents (diff)
downloadsynapse-df727f212606b771b1410c8e322fb8a99d159de4.tar.xz
Fix stuck invites
If rejecting a remote invite fails with an error response don't fail
the entire request; instead mark the invite as locally rejected.

This fixes the bug where users can get stuck invites which they can
neither accept nor reject.
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r--synapse/handlers/room_member.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index f1c3e90ecd..6c7409215a 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -258,10 +258,20 @@ class RoomMemberHandler(BaseHandler):
                 else:
                     # send the rejection to the inviter's HS.
                     remote_room_hosts = remote_room_hosts + [inviter.domain]
-                    ret = yield self.reject_remote_invite(
-                        target.to_string(), room_id, remote_room_hosts
-                    )
-                    defer.returnValue(ret)
+
+                    try:
+                        ret = yield self.reject_remote_invite(
+                            target.to_string(), room_id, remote_room_hosts
+                        )
+                        defer.returnValue(ret)
+                    except SynapseError as e:
+                        logger.warn("Failed to reject invite: %s", e)
+
+                        yield self.store.locally_reject_invite(
+                            target.to_string(), room_id
+                        )
+
+                        defer.returnValue({})
 
         yield self._local_membership_update(
             requester=requester,