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
cd323758
Commit
cd323758
authored
5 years ago
by
Brendan Abolivier
Browse files
Options
Downloads
Patches
Plain Diff
Add option to disable per-room profiles
parent
4a6d5de9
Branches
Branches containing commit
Tags
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/config/server.py
+11
-0
11 additions, 0 deletions
synapse/config/server.py
synapse/handlers/room_member.py
+9
-0
9 additions, 0 deletions
synapse/handlers/room_member.py
with
20 additions
and
0 deletions
synapse/config/server.py
+
11
−
0
View file @
cd323758
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2017-2018 New Vector Ltd
# Copyright 2017-2018 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -173,6 +174,10 @@ class ServerConfig(Config):
...
@@ -173,6 +174,10 @@ class ServerConfig(Config):
"
require_membership_for_aliases
"
,
True
,
"
require_membership_for_aliases
"
,
True
,
)
)
# Whether to allow per-room membership profiles through the send of membership
# events with profile information that differ from the target's global profile.
self
.
allow_per_room_profiles
=
config
.
get
(
"
allow_per_room_profiles
"
,
True
)
self
.
listeners
=
[]
self
.
listeners
=
[]
for
listener
in
config
.
get
(
"
listeners
"
,
[]):
for
listener
in
config
.
get
(
"
listeners
"
,
[]):
if
not
isinstance
(
listener
.
get
(
"
port
"
,
None
),
int
):
if
not
isinstance
(
listener
.
get
(
"
port
"
,
None
),
int
):
...
@@ -566,6 +571,12 @@ class ServerConfig(Config):
...
@@ -566,6 +571,12 @@ class ServerConfig(Config):
# Defaults to
'
true
'
.
# Defaults to
'
true
'
.
#
#
#require_membership_for_aliases: false
#require_membership_for_aliases: false
# Whether to allow per-room membership profiles through the send of membership
# events with profile information that differ from the target
'
s global profile.
# Defaults to
'
true
'
.
#
#allow_per_room_profiles: false
"""
%
locals
()
"""
%
locals
()
def
read_arguments
(
self
,
args
):
def
read_arguments
(
self
,
args
):
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/room_member.py
+
9
−
0
View file @
cd323758
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
# Copyright 2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -73,6 +74,7 @@ class RoomMemberHandler(object):
...
@@ -73,6 +74,7 @@ class RoomMemberHandler(object):
self
.
spam_checker
=
hs
.
get_spam_checker
()
self
.
spam_checker
=
hs
.
get_spam_checker
()
self
.
_server_notices_mxid
=
self
.
config
.
server_notices_mxid
self
.
_server_notices_mxid
=
self
.
config
.
server_notices_mxid
self
.
_enable_lookup
=
hs
.
config
.
enable_3pid_lookup
self
.
_enable_lookup
=
hs
.
config
.
enable_3pid_lookup
self
.
allow_per_room_profiles
=
self
.
config
.
allow_per_room_profiles
# This is only used to get at ratelimit function, and
# This is only used to get at ratelimit function, and
# maybe_kick_guest_users. It's fine there are multiple of these as
# maybe_kick_guest_users. It's fine there are multiple of these as
...
@@ -357,6 +359,13 @@ class RoomMemberHandler(object):
...
@@ -357,6 +359,13 @@ class RoomMemberHandler(object):
# later on.
# later on.
content
=
dict
(
content
)
content
=
dict
(
content
)
if
not
self
.
allow_per_room_profiles
:
# Strip profile data, knowing that new profile data will be added to the
# event's content in event_creation_handler.create_event() using the target's
# global profile.
content
.
pop
(
"
displayname
"
,
None
)
content
.
pop
(
"
avatar_url
"
,
None
)
effective_membership_state
=
action
effective_membership_state
=
action
if
action
in
[
"
kick
"
,
"
unban
"
]:
if
action
in
[
"
kick
"
,
"
unban
"
]:
effective_membership_state
=
"
leave
"
effective_membership_state
=
"
leave
"
...
...
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