diff options
author | Mark Haines <mjark@negativecurvature.net> | 2015-10-14 13:56:23 +0100 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2015-10-14 13:56:23 +0100 |
commit | a05976095493ae0648f6bf0bb684eb89cf7af501 (patch) | |
tree | 8af411f17615d59b86a92254e63076da0ee646d3 /synapse/storage | |
parent | Merge pull request #304 from matrix-org/erikj/remove_unused_arg (diff) | |
parent | Fix v2 sync polling (diff) | |
download | synapse-a05976095493ae0648f6bf0bb684eb89cf7af501.tar.xz |
Merge pull request #305 from matrix-org/markjh/v2_sync_api
Update the v2 sync API to work as specified in the current spec.
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/roommember.py | 14 |
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. |