diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-10-19 17:26:18 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-10-19 17:26:18 +0100 |
commit | 68b7fc3e2ba0aae7813b0bae52370860b5cd9f26 (patch) | |
tree | 1f7a361996c8b16916376433b478583307430793 /synapse/storage/roommember.py | |
parent | Merge pull request #310 from matrix-org/markjh/bcrypt_rounds (diff) | |
download | synapse-68b7fc3e2ba0aae7813b0bae52370860b5cd9f26.tar.xz |
Add rooms that the user has left under archived in v2 sync.
Diffstat (limited to 'synapse/storage/roommember.py')
-rw-r--r-- | synapse/storage/roommember.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index dd98dcfda8..623400fd36 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_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] + ).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. |