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
69ce55c5
Unverified
Commit
69ce55c5
authored
5 years ago
by
Brendan Abolivier
Browse files
Options
Downloads
Patches
Plain Diff
Don't filter out dummy events when we're checking the visibility of state
parent
54dd2862
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/handlers/message.py
+1
-1
1 addition, 1 deletion
synapse/handlers/message.py
synapse/visibility.py
+7
-8
7 additions, 8 deletions
synapse/visibility.py
with
8 additions
and
9 deletions
synapse/handlers/message.py
+
1
−
1
View file @
69ce55c5
...
@@ -160,7 +160,7 @@ class MessageHandler(object):
...
@@ -160,7 +160,7 @@ class MessageHandler(object):
raise
NotFoundError
(
"
Can
'
t find event for token %s
"
%
(
at_token
,))
raise
NotFoundError
(
"
Can
'
t find event for token %s
"
%
(
at_token
,))
visible_events
=
yield
filter_events_for_client
(
visible_events
=
yield
filter_events_for_client
(
self
.
storage
,
user_id
,
last_events
,
apply_retention_policies
=
False
self
.
storage
,
user_id
,
last_events
,
filter_send_to_client
=
False
)
)
event
=
last_events
[
0
]
event
=
last_events
[
0
]
...
...
This diff is collapsed.
Click to expand it.
synapse/visibility.py
+
7
−
8
View file @
69ce55c5
...
@@ -49,7 +49,7 @@ def filter_events_for_client(
...
@@ -49,7 +49,7 @@ def filter_events_for_client(
events
,
events
,
is_peeking
=
False
,
is_peeking
=
False
,
always_include_ids
=
frozenset
(),
always_include_ids
=
frozenset
(),
apply_retention_policies
=
True
,
filter_send_to_client
=
True
,
):
):
"""
"""
Check which events a user is allowed to see. If the user can see the event but its
Check which events a user is allowed to see. If the user can see the event but its
...
@@ -65,10 +65,9 @@ def filter_events_for_client(
...
@@ -65,10 +65,9 @@ def filter_events_for_client(
events
events
always_include_ids (set(event_id)): set of event ids to specifically
always_include_ids (set(event_id)): set of event ids to specifically
include (unless sender is ignored)
include (unless sender is ignored)
apply_retention_policies (bool): Whether to filter out events that
'
s older than
filter_send_to_client (bool): Whether we
'
re checking an event that
'
s going to be
allowed by the room
'
s retention policy. Useful when this function is called
sent to a client. This might not always be the case since this function can
to e.g. check whether a user should be allowed to see the state at a given
also be called to check whether a user can see the state at a given point.
event rather than to know if it should send an event to a user
'
s client(s).
Returns:
Returns:
Deferred[list[synapse.events.EventBase]]
Deferred[list[synapse.events.EventBase]]
...
@@ -96,7 +95,7 @@ def filter_events_for_client(
...
@@ -96,7 +95,7 @@ def filter_events_for_client(
erased_senders
=
yield
storage
.
main
.
are_users_erased
((
e
.
sender
for
e
in
events
))
erased_senders
=
yield
storage
.
main
.
are_users_erased
((
e
.
sender
for
e
in
events
))
if
apply_retention_policies
:
if
not
filter_send_to_client
:
room_ids
=
{
e
.
room_id
for
e
in
events
}
room_ids
=
{
e
.
room_id
for
e
in
events
}
retention_policies
=
{}
retention_policies
=
{}
...
@@ -119,7 +118,7 @@ def filter_events_for_client(
...
@@ -119,7 +118,7 @@ def filter_events_for_client(
the original event if they can see it as normal.
the original event if they can see it as normal.
"""
"""
if
event
.
type
==
"
org.matrix.dummy_event
"
:
if
event
.
type
==
"
org.matrix.dummy_event
"
and
filter_send_to_client
:
return
None
return
None
if
not
event
.
is_state
()
and
event
.
sender
in
ignore_list
:
if
not
event
.
is_state
()
and
event
.
sender
in
ignore_list
:
...
@@ -134,7 +133,7 @@ def filter_events_for_client(
...
@@ -134,7 +133,7 @@ def filter_events_for_client(
# Don't try to apply the room's retention policy if the event is a state event, as
# Don't try to apply the room's retention policy if the event is a state event, as
# MSC1763 states that retention is only considered for non-state events.
# MSC1763 states that retention is only considered for non-state events.
if
apply_retention_policies
and
not
event
.
is_state
():
if
filter_send_to_client
and
not
event
.
is_state
():
retention_policy
=
retention_policies
[
event
.
room_id
]
retention_policy
=
retention_policies
[
event
.
room_id
]
max_lifetime
=
retention_policy
.
get
(
"
max_lifetime
"
)
max_lifetime
=
retention_policy
.
get
(
"
max_lifetime
"
)
...
...
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