summary refs log tree commit diff
path: root/synapse/storage/roommember.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-10-21 15:48:34 +0100
committerMark Haines <mark.haines@matrix.org>2015-10-21 15:48:34 +0100
commit5201c661082cb66e544c968ab3d5d97278509774 (patch)
tree1a23e19f9be1c6139fbff4052b416261d6aadcd6 /synapse/storage/roommember.py
parentDoc string for the SyncHandler.typing_by_room method (diff)
parentMerge pull request #316 from matrix-org/markjh/v2_sync_archived (diff)
downloadsynapse-5201c661082cb66e544c968ab3d5d97278509774.tar.xz
Merge branch 'develop' into markjh/v2_sync_typing
Conflicts:
	synapse/handlers/sync.py
Diffstat (limited to 'synapse/storage/roommember.py')
-rw-r--r--synapse/storage/roommember.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index dd98dcfda8..ae1ad56d9a 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -124,6 +124,19 @@ class RoomMemberStore(SQLBaseStore):
             invites.event_id for invite in invites
         ]))
 
+    def get_leave_and_ban_events_for_user(self, user_id):
+        """ Get all the leave events for a user
+        Args:
+            user_id (str): The user ID.
+        Returns:
+            A deferred list of event objects.
+        """
+        return self.get_rooms_for_user_where_membership_is(
+            user_id, (Membership.LEAVE, Membership.BAN)
+        ).addCallback(lambda leaves: self._get_events([
+            leave.event_id for leave in leaves
+        ]))
+
     def get_rooms_for_user_where_membership_is(self, user_id, membership_list):
         """ Get all the rooms for this user where the membership for this user
         matches one in the membership list.