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
2ab0bf4b
Commit
2ab0bf4b
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Send history visibility on boundary changes
parent
389d558a
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/_base.py
+26
-0
26 additions, 0 deletions
synapse/handlers/_base.py
with
26 additions
and
0 deletions
synapse/handlers/_base.py
+
26
−
0
View file @
2ab0bf4b
...
...
@@ -29,6 +29,14 @@ import logging
logger
=
logging
.
getLogger
(
__name__
)
VISIBILITY_PRIORITY
=
(
"
world_readable
"
,
"
shared
"
,
"
invited
"
,
"
joined
"
,
)
class
BaseHandler
(
object
):
"""
Common base class for the event handlers.
...
...
@@ -85,10 +93,28 @@ class BaseHandler(object):
else
:
visibility
=
"
shared
"
if
visibility
not
in
VISIBILITY_PRIORITY
:
visibility
=
"
shared
"
# if it was world_readable, it's easy: everyone can read it
if
visibility
==
"
world_readable
"
:
return
True
# Always allow history visibility events on boundaries. This is done
# by setting the effective visibility to the least restrictive
# of the old vs new.
if
event
.
type
==
EventTypes
.
RoomHistoryVisibility
:
prev_content
=
event
.
unsigned
.
get
(
"
prev_content
"
,
{})
prev_visibility
=
prev_content
.
get
(
"
history_visibility
"
,
None
)
if
prev_visibility
not
in
VISIBILITY_PRIORITY
:
prev_visibility
=
"
shared
"
new_priority
=
VISIBILITY_PRIORITY
.
index
(
visibility
)
old_priority
=
VISIBILITY_PRIORITY
.
index
(
prev_visibility
)
if
old_priority
<
new_priority
:
visibility
=
prev_visibility
# get the user's membership at the time of the event. (or rather,
# just *after* the event. Which means that people can see their
# own join events, but not (currently) their own leave events.)
...
...
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