Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
f2cf3751
Commit
f2cf3751
authored
9 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Filter typing nofication events to only those rooms the requesting user is a member of (SYN-328)
parent
04c7f357
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/typing.py
+14
-2
14 additions, 2 deletions
synapse/handlers/typing.py
with
14 additions
and
2 deletions
synapse/handlers/typing.py
+
14
−
2
View file @
f2cf3751
...
...
@@ -223,6 +223,7 @@ class TypingNotificationEventSource(object):
def
__init__
(
self
,
hs
):
self
.
hs
=
hs
self
.
_handler
=
None
self
.
_room_member_handler
=
None
def
handler
(
self
):
# Avoid cyclic dependency in handler setup
...
...
@@ -230,6 +231,11 @@ class TypingNotificationEventSource(object):
self
.
_handler
=
self
.
hs
.
get_handlers
().
typing_notification_handler
return
self
.
_handler
def
room_member_handler
(
self
):
if
not
self
.
_room_member_handler
:
self
.
_room_member_handler
=
self
.
hs
.
get_handlers
().
room_member_handler
return
self
.
_room_member_handler
def
_make_event_for
(
self
,
room_id
):
typing
=
self
.
handler
().
_room_typing
[
room_id
]
return
{
...
...
@@ -240,19 +246,25 @@ class TypingNotificationEventSource(object):
},
}
@defer.inlineCallbacks
def
get_new_events_for_user
(
self
,
user
,
from_key
,
limit
):
from_key
=
int
(
from_key
)
handler
=
self
.
handler
()
joined_room_ids
=
(
yield
self
.
room_member_handler
().
get_joined_rooms_for_user
(
user
)
)
events
=
[]
for
room_id
in
handler
.
_room_serials
:
if
room_id
not
in
joined_room_ids
:
continue
if
handler
.
_room_serials
[
room_id
]
<=
from_key
:
continue
# TODO: check if user is in room
events
.
append
(
self
.
_make_event_for
(
room_id
))
return
defer
.
succeed
((
events
,
handler
.
_latest_room_serial
))
defer
.
returnValue
((
events
,
handler
.
_latest_room_serial
))
def
get_current_key
(
self
):
return
self
.
handler
().
_latest_room_serial
...
...
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