mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-28 15:08:49 +03:00
Clean up the presence_list checking logic a bit
This commit is contained in:
parent
e4c65b338d
commit
e01b825cc9
1 changed files with 9 additions and 12 deletions
|
@ -1084,12 +1084,12 @@ class PresenceEventSource(object):
|
||||||
clock = self.clock
|
clock = self.clock
|
||||||
latest_serial = 0
|
latest_serial = 0
|
||||||
|
|
||||||
|
user_ids_to_check = {user}
|
||||||
presence_list = yield presence.store.get_presence_list(
|
presence_list = yield presence.store.get_presence_list(
|
||||||
user.localpart, accepted=True
|
user.localpart, accepted=True
|
||||||
)
|
)
|
||||||
if presence_list is None:
|
if presence_list is not None:
|
||||||
presence_list = ()
|
user_ids_to_check |= set(
|
||||||
user_ids_to_check = set(
|
|
||||||
UserID.from_string(p["observed_user_id"]) for p in presence_list
|
UserID.from_string(p["observed_user_id"]) for p in presence_list
|
||||||
)
|
)
|
||||||
room_ids = yield presence.get_joined_rooms_for_user(user)
|
room_ids = yield presence.get_joined_rooms_for_user(user)
|
||||||
|
@ -1142,8 +1142,6 @@ class PresenceEventSource(object):
|
||||||
def get_pagination_rows(self, user, pagination_config, key):
|
def get_pagination_rows(self, user, pagination_config, key):
|
||||||
# TODO (erikj): Does this make sense? Ordering?
|
# TODO (erikj): Does this make sense? Ordering?
|
||||||
|
|
||||||
observer_user = user
|
|
||||||
|
|
||||||
from_key = int(pagination_config.from_key)
|
from_key = int(pagination_config.from_key)
|
||||||
|
|
||||||
if pagination_config.to_key:
|
if pagination_config.to_key:
|
||||||
|
@ -1158,8 +1156,7 @@ class PresenceEventSource(object):
|
||||||
presence_list = yield presence.store.get_presence_list(
|
presence_list = yield presence.store.get_presence_list(
|
||||||
user.localpart, accepted=True
|
user.localpart, accepted=True
|
||||||
)
|
)
|
||||||
if presence_list is None:
|
if presence_list is not None:
|
||||||
presence_list = ()
|
|
||||||
user_ids_to_check |= set(
|
user_ids_to_check |= set(
|
||||||
UserID.from_string(p["observed_user_id"]) for p in presence_list
|
UserID.from_string(p["observed_user_id"]) for p in presence_list
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue