Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC3386: Unified Join Rules #3386

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

kevincox
Copy link

@kevincox kevincox commented Sep 7, 2021

Signed-off-by: Kevin Cox <kevincox@kevincox.ca>

Fixes: https://github.com/matrix-org/matrix-doc/issues/3297
@@ -0,0 +1,197 @@
# MSC0000: Unified Join Rules

[MSC2403 Knock](./2403-knock.md) and [MSC3083 Restricting room membership based on membership in other rooms](./3083-restricted-rooms.md) both update the join rules of a room to allow a new feature. The former defines `join_rule: knock` which allows anyone to knock to enter a room and the latter defines `join_rule: restricted` to restrict who can join a room based on a set of rules. Unfortunately these features can not be used together as a room can only have one `join_rule`.
Copy link
Member

Choose a reason for hiding this comment

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

Please line wrap to roughly 100 characters. Links to MSCs should be github links rather than the markdown documents to ensure conversation context and threads are maintained.

Copy link
Author

@kevincox kevincox Sep 7, 2021

Choose a reason for hiding this comment

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

Will do.

@turt2live turt2live changed the title Create Unified Join Rules MSC. [WIP] MSC3386: Unified Join Rules Sep 7, 2021
@turt2live turt2live added client-server Client-Server API kind:maintenance MSC which clarifies/updates existing spec proposal A matrix spec change proposal labels Sep 7, 2021
@ShadowJonathan
Copy link
Contributor

@kevincox You forgot to add a "rendered" link

kevincox and others added 2 commits September 8, 2021 16:08
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
@kevincox kevincox marked this pull request as ready for review September 8, 2021 20:15
Since the new `allow_knock` attribute allows non-members to submit events to the room it needs to be understood by all servers to maintain sync. Therefore a new room version is required. Since a new room version is required it makes sense to drop all backwards compatibility to keep the new `join_rules` as clean and consistent as possible.

See matrix-org#3386 (comment) for more context.
Copy link
Contributor

@Dominaezzz Dominaezzz left a comment

Choose a reason for hiding this comment

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

Please, either don't remove the join_rule key or create a new state event.


### Useless `allow_knock` entires.

It is possible that entries in `allow_knock` are redundant because they are also included in `allow_join` so could simply join directly. While this is unsightly it is non-harmful and will not affect users or servers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant is a strong word I think. People are currently able to send invites to public rooms, so knocking on public rooms seems perfectly fine, at least we already have this "problem".
In fact, one may want to explicitly prevent knocking in their public rooms to prevent spam or something.

Copy link
Author

Choose a reason for hiding this comment

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

I can re-word this section to be a bit softer. I still think it makes a "rarely useful" configuration possible but I don't think it is very harmful anyways.

proposals/3386-unified-join-rules.md Show resolved Hide resolved
proposals/3386-unified-join-rules.md Show resolved Hide resolved
proposals/3386-unified-join-rules.md Show resolved Hide resolved
proposals/3386-unified-join-rules.md Show resolved Hide resolved

### `join_rule`

The `join_rule` key is removed.
Copy link
Contributor

Choose a reason for hiding this comment

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

For the sake of client side backwards compatibility and spec consistency, please don't remove this key.

Can this instead be a new join_rule, like "custom", "granular", "msc3386", etc ?

{
	"type": "m.room.join_rules"
	"state_key": ""
	"content": {
		"join_rule": "custom",
		"allow_join": [{
			"type": "m.room_membership"
			"room_id": "!users:example.org"
		}]
		"allow_knock": [{
			"type": "m.any"
		}],
	},
}

In addition to this, the allow_ prefixes now seem unnecessary.

Copy link
Member

@tulir tulir Nov 30, 2021

Choose a reason for hiding this comment

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

There's no need for the join rule key so some random static value like that seems pretty pointless.

Adding a fake join_rule key (either in the actual federated event, or inject it server-locally before serving the event to clients) that corresponds best to the rules in the room would probably be best for backwards compatibility. For example, set "join_rule": "public" if the room has allow_join with m.any. It wouldn't do anything in the protocol/server, but old clients that don't know better would use it and display something reasonably correct. Including the fake keys could then be phased out eventually.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not suggesting a random static value, I'm suggesting a new join rule. This would allow old style join rules to still work. So older clients would still be update the join rules. This seems to me, a low price for some backwards compat.

I think it's better to create a separate m.room.knock_rules than to break this schema anyway IMO.

Copy link
Author

Choose a reason for hiding this comment

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

This was also discussed here which is how the MSC got to the current state: #3386 (comment)

Picking a new name for the join rule may make it less error-prone on clients. Originally it was kept the same because the rules were mostly-compatible. But since compatibility has largely been dropped picking a new name makes more sense.

@jcgruenhage
Copy link
Contributor

@kevincox looks good to me, and looking forward to this one! One small nitpick: Is this ready for review? The PR title still says WIP, while it seems that you marked this ready for review 15h ago

@uhoreg uhoreg added the needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. label Jan 10, 2022
@kevincox
Copy link
Author

kevincox commented Jan 10, 2022

Thanks. Updated the title. I thought I removed this from draft weeks ago 😅

@kevincox kevincox changed the title [WIP] MSC3386: Unified Join Rules MSC3386: Unified Join Rules Jan 10, 2022
@Mikaela Mikaela mentioned this pull request Feb 3, 2022
2 tasks
Copy link
Member

@KitsuneRal KitsuneRal left a comment

Choose a reason for hiding this comment

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

I really like where this is going; but a few more eyeballs on it would be great.

}
```

Clients may consider helping users to clean up unnecessary elements from the `allow_join` and `allow_knock` lists.
Copy link
Member

Choose a reason for hiding this comment

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

Can we lay this over on homeservers instead, actually?

Copy link
Author

Choose a reason for hiding this comment

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

We could but I was thinking it would be best to keep the initial version of this small. There is no reason that we couldn't require homeservers to do particular cleanups in the future.

Copy link

Choose a reason for hiding this comment

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

As noted in another comment thread, having overlap between different join rules may be intentional and should be allowed, rather than rejected/automatically "corrected" by the homeserver.

Copy link

@Xiretza Xiretza left a comment

Choose a reason for hiding this comment

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

I'd love to see this, since it paves the way for better and more fine-grained join rules in future MSCs.

}
```

### Conversion
Copy link

Choose a reason for hiding this comment

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

This could use an update for knock_restricted:

knock_restricted

A join_rules state event with join_rule: knock_restricted can be replaced by an event with the following template. Substitute the previous elements from the allow attribute into the allow_join attribute.

{
	"type": "m.room.join_rules"
	"state_key": ""
	"content": {
		"allow_knock": [{
			"type": "m.any"
		}],
		"allow_join": // Value from `allow` attribute of previous `join_rules`.
	}
}

For example the following join_rules...

{
	"type": "m.room.join_rules"
	"state_key": ""
	"content": {
		"join_rule": "knock_restricted"
		"allow": [ {
			"type": "m.room_membership"
			"room_id": "!mods:example.org"
		}, {
			"type": "m.room_membership"
			"room_id": "!users:example.org"
		}]
	}
}

...becomes...

{
	"type": "m.room.join_rules"
	"state_key": ""
	"content": {
		"allow_knock": [{
			"type": "m.any"
		}],
		"allow_join": [{
			"type": "m.room_membership"
			"room_id": "!mods:example.org"
		}, {
			"type": "m.room_membership"
			"room_id": "!users:example.org"
		}]
	}
}

}
```

Clients may consider helping users to clean up unnecessary elements from the `allow_join` and `allow_knock` lists.
Copy link

Choose a reason for hiding this comment

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

As noted in another comment thread, having overlap between different join rules may be intentional and should be allowed, rather than rejected/automatically "corrected" by the homeserver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants