mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-27 04:59:23 -05:00
Set the PL for aliases events to 0.
This commit is contained in:
parent
ee42a5513e
commit
b36095ae5c
@ -449,7 +449,7 @@ def copy_power_levels_contents(
|
|||||||
# we should only have one level of nesting
|
# we should only have one level of nesting
|
||||||
if not isinstance(v1, int):
|
if not isinstance(v1, int):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"Invalid power_levels value for %s.%s: %r" % (k, k1, v)
|
"Invalid power_levels value for %s.%s: %r" % (k, k1, v1)
|
||||||
)
|
)
|
||||||
h[k1] = v1
|
h[k1] = v1
|
||||||
continue
|
continue
|
||||||
|
@ -287,7 +287,16 @@ class RoomCreationHandler(BaseHandler):
|
|||||||
except AuthError as e:
|
except AuthError as e:
|
||||||
logger.warning("Unable to update PLs in old room: %s", e)
|
logger.warning("Unable to update PLs in old room: %s", e)
|
||||||
|
|
||||||
logger.info("Setting correct PLs in new room to %s", old_room_pl_state.content)
|
new_pl_content = copy_power_levels_contents(old_room_pl_state.content)
|
||||||
|
|
||||||
|
# pre-msc2260 rooms may not have the right setting for aliases. If no other
|
||||||
|
# value is set, set it now.
|
||||||
|
events_default = new_pl_content.get("events_default", 0)
|
||||||
|
new_pl_content.setdefault("events", {}).setdefault(
|
||||||
|
EventTypes.Aliases, events_default
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.info("Setting correct PLs in new room to %s", new_pl_content)
|
||||||
yield self.event_creation_handler.create_and_send_nonmember_event(
|
yield self.event_creation_handler.create_and_send_nonmember_event(
|
||||||
requester,
|
requester,
|
||||||
{
|
{
|
||||||
@ -295,7 +304,7 @@ class RoomCreationHandler(BaseHandler):
|
|||||||
"state_key": "",
|
"state_key": "",
|
||||||
"room_id": new_room_id,
|
"room_id": new_room_id,
|
||||||
"sender": requester.user.to_string(),
|
"sender": requester.user.to_string(),
|
||||||
"content": old_room_pl_state.content,
|
"content": new_pl_content,
|
||||||
},
|
},
|
||||||
ratelimit=False,
|
ratelimit=False,
|
||||||
)
|
)
|
||||||
@ -812,6 +821,10 @@ class RoomCreationHandler(BaseHandler):
|
|||||||
EventTypes.RoomHistoryVisibility: 100,
|
EventTypes.RoomHistoryVisibility: 100,
|
||||||
EventTypes.CanonicalAlias: 50,
|
EventTypes.CanonicalAlias: 50,
|
||||||
EventTypes.RoomAvatar: 50,
|
EventTypes.RoomAvatar: 50,
|
||||||
|
# MSC2260: Allow everybody to send alias events by default
|
||||||
|
# This will be reudundant on pre-MSC2260 rooms, since the
|
||||||
|
# aliases event is special-cased.
|
||||||
|
EventTypes.Aliases: 0,
|
||||||
},
|
},
|
||||||
"events_default": 0,
|
"events_default": 0,
|
||||||
"state_default": 50,
|
"state_default": 50,
|
||||||
|
Loading…
Reference in New Issue
Block a user