Skip to content

MSC3214: Allow overriding m.room.power_levels using initial_state#3214

Open
tulir wants to merge 1 commit into
matrix-org:old_masterfrom
tulir:initial-state-power-levels
Open

MSC3214: Allow overriding m.room.power_levels using initial_state#3214
tulir wants to merge 1 commit into
matrix-org:old_masterfrom
tulir:initial-state-power-levels

Conversation

@tulir
Copy link
Copy Markdown
Member

@tulir tulir commented May 24, 2021

Signed-off-by: Tulir Asokan <tulir@maunium.net>
@uhoreg uhoreg added kind:maintenance MSC which clarifies/updates existing spec proposal A matrix spec change proposal proposal-in-review labels May 24, 2021
@turt2live turt2live self-requested a review June 8, 2021 15:10
Comment on lines +36 to +38
`power_level_content_override` can technically be used to undo everything in
the default power levels, but it's more convenient and intuitive if
`initial_state` can be used to simply replace the first power level event.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having troubles seeing why this isn't acceptable for an approach: changing the semantics of initial_state for one event type feels overly wrong, and power_level_content_override is perfectly able to accept a complete content.

Is the primary concern code cleanliness?

levels. The spec defines a `power_level_content_override` field that is applied
on top of the default power levels for this purpose. However, that field can't
easily replace the entire default content, as it gets merged with the default
levels.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think power_level_content_override should be deprecated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this MSC complicates the situation of initial_state vs override a bit, as override overrides certain bits of the to-be-created state event, while initial_state would replace the entire powerlevels event.

This would create different results on different room versions, if the default powerlevels would ever be changed.

Comment on lines +8 to +12
Synapse already allows replacing the entire power level event content by
placing a power level event in `initial_state`. However, interpreting the spec
literally means inserting the default power level event first, then inserting
the one from `initial_state`, which might not be possible due to auth rules
anymore.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the algorithm seems to have been specced in 2016 by #362. Synapse's implementation was changed in 2017 by matrix-org/synapse#2291, but that did not get transferred to the spec.

Server implementations will have to separately check for `m.room.power_levels`
events in the `initial_state` list, which is slightly more effort than the
current flow.

Copy link
Copy Markdown
Contributor

@deepbluev7 deepbluev7 Apr 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks some approaches of sending PLs. While those currently also don't work on synapse, they should and imo it is a bug.

I.e. imagine you want to demote yourself after creating the room. Currently you should be able to send an override, where you are PL100, add events to initial_state, that require PL100 to send and then as the last event in initial_state you send a PL event that demotes you. While that is a niche usecase, it occasionally comes up and it is currently impossible to do without doing 2 separate requests. Otoh, the only thing this MSC achieves is make the power level overrides unnecessary, but it doesn't enable any usecases that couldn't be done by just putting the PL content into the override instead.

See also: matrix-org/synapse#11731 (comment)

events in the `initial_state` list, which is slightly more effort than the
current flow.

## Alternatives
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of applying only m.room.power_levels from initial_state in step 3, could you apply power_level_content_override in step 6 if and only if initial_state contains no power levels event? This way the contents of initial_state would not be processed in different steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:maintenance MSC which clarifies/updates existing spec proposal A matrix spec change proposal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants