mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-09 14:12:05 +00:00
Do user_id != me checks before deciding whether we should pick heroes from the joined members or the parted ones
This commit is contained in:
parent
2615c6bd9e
commit
dbbaf25dd3
@ -598,15 +598,28 @@ class SyncHandler(object):
|
||||
if canonical_alias and canonical_alias.content:
|
||||
defer.returnValue(summary)
|
||||
|
||||
me = sync_config.user.to_string()
|
||||
|
||||
joined_user_ids = [
|
||||
r[0] for r in details.get(Membership.JOIN, empty_ms).members
|
||||
r[0]
|
||||
for r in details.get(Membership.JOIN, empty_ms).members
|
||||
if r[0] != me
|
||||
]
|
||||
invited_user_ids = [
|
||||
r[0] for r in details.get(Membership.INVITE, empty_ms).members
|
||||
r[0]
|
||||
for r in details.get(Membership.INVITE, empty_ms).members
|
||||
if r[0] != me
|
||||
]
|
||||
gone_user_ids = (
|
||||
[r[0] for r in details.get(Membership.LEAVE, empty_ms).members] +
|
||||
[r[0] for r in details.get(Membership.BAN, empty_ms).members]
|
||||
[
|
||||
r[0]
|
||||
for r in details.get(Membership.LEAVE, empty_ms).members
|
||||
if r[0] != me
|
||||
] + [
|
||||
r[0]
|
||||
for r in details.get(Membership.BAN, empty_ms).members
|
||||
if r[0] != me
|
||||
]
|
||||
)
|
||||
|
||||
# FIXME: only build up a member_ids list for our heroes
|
||||
@ -621,22 +634,13 @@ class SyncHandler(object):
|
||||
member_ids[user_id] = event_id
|
||||
|
||||
# FIXME: order by stream ordering rather than as returned by SQL
|
||||
me = sync_config.user.to_string()
|
||||
if (joined_user_ids or invited_user_ids):
|
||||
summary['m.heroes'] = sorted(
|
||||
[
|
||||
user_id
|
||||
for user_id in (joined_user_ids + invited_user_ids)
|
||||
if user_id != me
|
||||
]
|
||||
[user_id for user_id in (joined_user_ids + invited_user_ids)]
|
||||
)[0:5]
|
||||
else:
|
||||
summary['m.heroes'] = sorted(
|
||||
[
|
||||
user_id
|
||||
for user_id in gone_user_ids
|
||||
if user_id != me
|
||||
]
|
||||
[user_id for user_id in gone_user_ids]
|
||||
)[0:5]
|
||||
|
||||
if not sync_config.filter_collection.lazy_load_members():
|
||||
|
Loading…
Reference in New Issue
Block a user