Include banned rooms in the archived section of v2 sync
parent
51d03e65b2
commit
e3d75f564a
|
@ -175,9 +175,12 @@ class SyncHandler(BaseHandler):
|
||||||
)
|
)
|
||||||
room_list = yield self.store.get_rooms_for_user_where_membership_is(
|
room_list = yield self.store.get_rooms_for_user_where_membership_is(
|
||||||
user_id=sync_config.user.to_string(),
|
user_id=sync_config.user.to_string(),
|
||||||
membership_list=[
|
membership_list=(
|
||||||
Membership.INVITE, Membership.JOIN, Membership.LEAVE
|
Membership.INVITE,
|
||||||
]
|
Membership.JOIN,
|
||||||
|
Membership.LEAVE,
|
||||||
|
Membership.BAN
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
joined = []
|
joined = []
|
||||||
|
@ -195,7 +198,7 @@ class SyncHandler(BaseHandler):
|
||||||
room_id=event.room_id,
|
room_id=event.room_id,
|
||||||
invite=invite,
|
invite=invite,
|
||||||
))
|
))
|
||||||
elif event.membership == Membership.LEAVE:
|
elif event.membership in (Membership.LEAVE, Membership.BAN):
|
||||||
leave_token = now_token.copy_and_replace(
|
leave_token = now_token.copy_and_replace(
|
||||||
"room_key", "s%d" % (event.stream_ordering,)
|
"room_key", "s%d" % (event.stream_ordering,)
|
||||||
)
|
)
|
||||||
|
@ -327,7 +330,7 @@ class SyncHandler(BaseHandler):
|
||||||
and event.state_key == sync_config.user.to_string()):
|
and event.state_key == sync_config.user.to_string()):
|
||||||
if event.membership == Membership.INVITE:
|
if event.membership == Membership.INVITE:
|
||||||
invite_events.append(event)
|
invite_events.append(event)
|
||||||
elif event.membership == Membership.LEAVE:
|
elif event.membership in (Membership.LEAVE, Membership.BAN):
|
||||||
leave_events.append(event)
|
leave_events.append(event)
|
||||||
|
|
||||||
for room_id in joined_room_ids:
|
for room_id in joined_room_ids:
|
||||||
|
@ -362,7 +365,7 @@ class SyncHandler(BaseHandler):
|
||||||
sync_config.user.to_string()
|
sync_config.user.to_string()
|
||||||
)
|
)
|
||||||
|
|
||||||
leave_events = yield self.store.get_leave_events_for_user(
|
leave_events = yield self.store.get_leave_and_ban_events_for_user(
|
||||||
sync_config.user.to_string()
|
sync_config.user.to_string()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ class RoomMemberStore(SQLBaseStore):
|
||||||
invites.event_id for invite in invites
|
invites.event_id for invite in invites
|
||||||
]))
|
]))
|
||||||
|
|
||||||
def get_leave_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
|
||||||
Args:
|
Args:
|
||||||
user_id (str): The user ID.
|
user_id (str): The user ID.
|
||||||
|
@ -132,7 +132,7 @@ class RoomMemberStore(SQLBaseStore):
|
||||||
A deferred list of event objects.
|
A deferred list of event objects.
|
||||||
"""
|
"""
|
||||||
return self.get_rooms_for_user_where_membership_is(
|
return self.get_rooms_for_user_where_membership_is(
|
||||||
user_id, [Membership.LEAVE]
|
user_id, (Membership.LEAVE, Membership.BAN)
|
||||||
).addCallback(lambda leaves: self._get_events([
|
).addCallback(lambda leaves: self._get_events([
|
||||||
leave.event_id for leave in leaves
|
leave.event_id for leave in leaves
|
||||||
]))
|
]))
|
||||||
|
|
Loading…
Reference in New Issue