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
757ed272
Commit
757ed272
authored
6 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Let users leave the server notice room after joining
They still can't reject invites, but we let them leave it.
parent
8c98281b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/server_notices.md
+5
-2
5 additions, 2 deletions
docs/server_notices.md
synapse/handlers/room_member.py
+14
-10
14 additions, 10 deletions
synapse/handlers/room_member.py
with
19 additions
and
12 deletions
docs/server_notices.md
+
5
−
2
View file @
757ed272
...
...
@@ -5,7 +5,7 @@ Server Notices
channel whereby server administrators can send messages to users on the server.
They are used as part of communication of the server polices(see
[
consent_tracking.md
](
consent_tracking.md
)
), however the intention is that
[
consent_tracking.md
](
consent_tracking.md
)
), however the intention is that
they may also find a use for features such as "Message of the day".
This is a feature specific to Synapse, but it uses standard Matrix
...
...
@@ -24,7 +24,10 @@ history; it will appear to have come from the 'server notices user' (see
below).
The user is prevented from sending any messages in this room by the power
levels. They also cannot leave it.
levels.
Having joined the room, the user can leave the room if they want. Subsequent
server notices will then cause a new room to be created.
Synapse configuration
---------------------
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/room_member.py
+
14
−
10
View file @
757ed272
...
...
@@ -298,16 +298,6 @@ class RoomMemberHandler(object):
is_blocked
=
yield
self
.
store
.
is_room_blocked
(
room_id
)
if
is_blocked
:
raise
SynapseError
(
403
,
"
This room has been blocked on this server
"
)
else
:
# we don't allow people to reject invites to, or leave, the
# server notice room.
is_blocked
=
yield
self
.
_is_server_notice_room
(
room_id
)
if
is_blocked
:
raise
SynapseError
(
http_client
.
FORBIDDEN
,
"
You cannot leave this room
"
,
errcode
=
Codes
.
CANNOT_LEAVE_SERVER_NOTICE_ROOM
,
)
if
effective_membership_state
==
Membership
.
INVITE
:
# block any attempts to invite the server notices mxid
...
...
@@ -383,6 +373,20 @@ class RoomMemberHandler(object):
if
same_sender
and
same_membership
and
same_content
:
defer
.
returnValue
(
old_state
)
# we don't allow people to reject invites to the server notice
# room, but they can leave it once they are joined.
if
(
old_membership
==
Membership
.
INVITE
and
effective_membership_state
==
Membership
.
LEAVE
):
is_blocked
=
yield
self
.
_is_server_notice_room
(
room_id
)
if
is_blocked
:
raise
SynapseError
(
http_client
.
FORBIDDEN
,
"
You cannot reject this invite
"
,
errcode
=
Codes
.
CANNOT_LEAVE_SERVER_NOTICE_ROOM
,
)
is_host_in_room
=
yield
self
.
_is_host_in_room
(
current_state_ids
)
if
effective_membership_state
==
Membership
.
JOIN
:
...
...
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