mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Merge pull request #663 from matrix-org/erikj/invite_for_user
Make get_invites return RoomsForUser
This commit is contained in:
commit
2749da542c
@ -317,7 +317,7 @@ class Pusher(object):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _get_badge_count(self):
|
def _get_badge_count(self):
|
||||||
invites, joins = yield defer.gatherResults([
|
invites, joins = yield defer.gatherResults([
|
||||||
self.store.get_invites_for_user(self.user_id),
|
self.store.get_invited_rooms_for_user(self.user_id),
|
||||||
self.store.get_rooms_for_user(self.user_id),
|
self.store.get_rooms_for_user(self.user_id),
|
||||||
], consumeErrors=True)
|
], consumeErrors=True)
|
||||||
|
|
||||||
|
@ -115,19 +115,17 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
).addCallback(self._get_events)
|
).addCallback(self._get_events)
|
||||||
|
|
||||||
@cached()
|
@cached()
|
||||||
def get_invites_for_user(self, user_id):
|
def get_invited_rooms_for_user(self, user_id):
|
||||||
""" Get all the invite events for a user
|
""" Get all the rooms the user is invited to
|
||||||
Args:
|
Args:
|
||||||
user_id (str): The user ID.
|
user_id (str): The user ID.
|
||||||
Returns:
|
Returns:
|
||||||
A deferred list of event objects.
|
A deferred list of RoomsForUser.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self.get_rooms_for_user_where_membership_is(
|
return self.get_rooms_for_user_where_membership_is(
|
||||||
user_id, [Membership.INVITE]
|
user_id, [Membership.INVITE]
|
||||||
).addCallback(lambda invites: self._get_events([
|
)
|
||||||
invite.event_id for invite in invites
|
|
||||||
]))
|
|
||||||
|
|
||||||
def get_leave_and_ban_events_for_user(self, user_id):
|
def get_leave_and_ban_events_for_user(self, user_id):
|
||||||
""" Get all the leave events for a user
|
""" Get all the leave events for a user
|
||||||
|
Loading…
Reference in New Issue
Block a user