Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
d6dadd95
Commit
d6dadd95
authored
7 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Correctly handle leaving room in /key/changes
parent
4a94eb3e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/handlers/device.py
+12
-13
12 additions, 13 deletions
synapse/handlers/device.py
with
12 additions
and
13 deletions
synapse/handlers/device.py
+
12
−
13
View file @
d6dadd95
...
...
@@ -292,12 +292,18 @@ class DeviceHandler(BaseHandler):
).
stream
possibly_changed
=
set
(
changed
)
possibly_left
_rooms
=
set
()
possibly_left
=
set
()
for
room_id
in
rooms_changed
:
current_state_ids
=
yield
self
.
store
.
get_current_state_ids
(
room_id
)
# The user may have left the room
# TODO: Check if they actually did or if we were just invited.
if
room_id
not
in
room_ids
:
possibly_left_rooms
.
add
(
room_id
)
for
key
,
event_id
in
current_state_ids
.
iteritems
():
etype
,
state_key
=
key
if
etype
!=
EventTypes
.
Member
:
continue
possibly_left
.
add
(
state_key
)
continue
# Fetch the current state at the time.
...
...
@@ -310,8 +316,6 @@ class DeviceHandler(BaseHandler):
# ordering: treat it the same as a new room
event_ids
=
[]
current_state_ids
=
yield
self
.
store
.
get_current_state_ids
(
room_id
)
# special-case for an empty prev state: include all members
# in the changed list
if
not
event_ids
:
...
...
@@ -354,16 +358,11 @@ class DeviceHandler(BaseHandler):
for
state_dict
in
prev_state_ids
.
itervalues
():
prev_event_id
=
state_dict
.
get
(
key
,
None
)
if
not
prev_event_id
or
prev_event_id
!=
event_id
:
possibly_changed
.
add
(
state_key
)
if
state_key
==
user_id
:
for
key
,
event_id
in
current_state_ids
.
iteritems
():
etype
,
state_key
=
key
if
etype
!=
EventTypes
.
Member
:
continue
possibly_changed
.
add
(
room_id
)
if
state_key
!=
user_id
:
possibly_changed
.
add
(
state_key
)
break
if
possibly_changed
:
if
possibly_changed
or
possibly_left
:
users_who_share_room
=
yield
self
.
store
.
get_users_who_share_room_with_user
(
user_id
)
...
...
@@ -371,7 +370,7 @@ class DeviceHandler(BaseHandler):
# Take the intersection of the users whose devices may have changed
# and those that actually still share a room with the user
possibly_joined
=
possibly_changed
&
users_who_share_room
possibly_left
=
possibly_changed
-
users_who_share_room
possibly_left
=
(
possibly_changed
|
possibly_left
)
-
users_who_share_room
else
:
possibly_joined
=
[]
possibly_left
=
[]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment