summary refs log tree commit diff
path: root/synapse/storage/roommember.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-10-15 16:37:32 +0100
committerErik Johnston <erik@matrix.org>2015-10-15 16:37:32 +0100
commitbcfb653816bc5a12f5bb55774cc2a0913aae69dd (patch)
tree486c983ec009886ff3ce3bfc5b6a0cf0f0445373 /synapse/storage/roommember.py
parentRemove unused constatns (diff)
parentMerge pull request #305 from matrix-org/markjh/v2_sync_api (diff)
downloadsynapse-bcfb653816bc5a12f5bb55774cc2a0913aae69dd.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/search
Diffstat (limited to 'synapse/storage/roommember.py')
-rw-r--r--synapse/storage/roommember.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 8c40d9a8a6..dd98dcfda8 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -110,6 +110,20 @@ class RoomMemberStore(SQLBaseStore):
             membership=membership,
         ).addCallback(self._get_events)
 
+    def get_invites_for_user(self, user_id):
+        """ Get all the invite 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.INVITE]
+        ).addCallback(lambda invites: self._get_events([
+            invites.event_id for invite in invites
+        ]))
+
     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.