-
Notifications
You must be signed in to change notification settings - Fork 385
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
MSC3765: Rich text in room topics #3765
Open
Johennes
wants to merge
21
commits into
main
Choose a base branch
from
johannes/rich-room-topics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9b914c6
Add rich room topic MSC
Johennes 06d315d
Rename to reflect propper MSC number
Johennes 09c7014
Fix typo
Johennes 1d0031a
Explain why m.topic is kept separate from m.message
Johennes 3b572e7
Use json5 for formatting code snippet
Johennes 6270109
Remove unneeded unstable room version
Johennes af184dd
Adapt to latest version of MSC1767
Johennes aa373d1
Add paragraph about preventing formatting abuse
Johennes ea93852
Introduce wrapping m.topic content block (#4111)
Johennes a6b1555
Clarify the case of HTML-only topics and transition logic (#4112)
Johennes 95fb38a
Make it more explicit that m.topic replaces m.room.topic without depr…
Johennes f915cc4
Remove line-based formatting logic and limit length of topics (#4182)
Johennes 385bf0b
Update MSC3765: Rich text in room topics (#4215)
Johennes bb726db
Accept suggestion
dbkr 1b4682e
Clarify length / display limits.
clokep d42f0e3
Apply clarifications from author
clokep fda22d8
Make MSC3765 independent of extensible events and new room versions (…
Johennes ac5c6fc
Apply suggestions from code review
richvdh 79e3f5d
Update proposals/3765-rich-room-topics.md
richvdh a64a825
Properly explain why the m.topic content block is needed (#4251)
Johennes c83f56d
Apply suggestions from code review
richvdh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# MSC3765: Rich text in room topics | ||
|
||
## Problem | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Topics are a central piece of room meta data and usually made easily | ||
accessible to room members in clients. As a result, room administrators | ||
often extend the use of topics to collect helpful peripheral information | ||
that is related to the room’s purpose. Most commonly these are links to | ||
external resources. At the moment, topics are limited to [plain text] | ||
which, depending on the number and length of URLs and other content, | ||
easily gets inconvenient to consume and calls for richer text formatting | ||
options. | ||
|
||
## Proposal | ||
|
||
To enrich `m.room.topic` events, we build upon extensible events as | ||
defined in [MSC1767] and define a new `m.topic` event in `content`. | ||
The latter contains a list of renderings in the same format that | ||
[MSC1767] uses for `m.message` events. | ||
|
||
```json5 | ||
{ | ||
"type": "m.room.topic", | ||
"state_key": "", | ||
"content": { | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"m.topic": [{ | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"mimetype": "text/html", // optional, default text/plain | ||
"body": "All about <b>pizza</b> | <a href=\"https://recipes.pizza.net\">Recipes</a>" | ||
}, { | ||
"mimetype": "text/plain", | ||
"body": "All about **pizza** | [Recipes](https://recipes.pizza.net)" | ||
}], | ||
}, | ||
... | ||
} | ||
``` | ||
|
||
While the content of `m.topic` is currently identical to `m.message`, a | ||
dedicated event type allows the two to diverge in the future. | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
A change to `/_matrix/client/v3/createRoom` is not necessary. The | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endpoint has a plain text `topic` parameter but also allows to specify a | ||
full `m.room.topic` event in `initial_state`. | ||
|
||
Room topics also occur as part of the `PublicRoomsChunk` object in the | ||
responses of `/_matrix/client/v3/publicRooms` and | ||
`/_matrix/client/v1/rooms/{roomId}/hierarchy`. The topic can be kept | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
plain text here because this data should commonly only be displayed to | ||
users that are *not* a member of the room yet. These users will not have | ||
the same need for rich room topics as users who are inside the room. | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Transition | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Similar to [MSC1767] a time-constrained transition period is proposed. | ||
Upon being included in a released version of the specification, the | ||
following happens: | ||
|
||
- The `topic` field in the content of `m.room.topic` events is | ||
deprecated | ||
- Clients continue to include `topic` in outgoing events as a fallback | ||
- Clients prefer the new `m.topic` format in events which include it | ||
- A 1 year timer begins for clients to implement the above conditions | ||
- This can be shortened if the ecosystem adopts the format sooner | ||
- After the (potentially shortened) timer, an MSC is introduced to | ||
remove the deprecated `topic` field. Once accepted under the | ||
relevant process, clients stop including the field in outgoing | ||
events. | ||
|
||
## Potential issues | ||
|
||
None. | ||
|
||
## Alternatives | ||
Johennes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The combination of `format` and `formatted_body` currently utilised to | ||
enable HTML in `m.room.message` events could be generalised to | ||
`m.room.topic` events. However, this would only allow for a single | ||
format in addition to plain text and is a weaker form of reuse as | ||
described in the introductory section of [MSC1767]. | ||
|
||
## Security considerations | ||
|
||
Allowing HTML in room topics is subject to the same security | ||
considerations that apply to HTML in room messages. | ||
|
||
## Unstable prefix | ||
|
||
While this MSC is not considered stable, `m.topic` should be referred | ||
to as `org.matrix.msc3765.topic`. | ||
|
||
## Dependencies | ||
|
||
- [MSC1767] | ||
|
||
[plain text]: https://spec.matrix.org/v1.2/client-server-api/#mroomtopic | ||
[MSC1767]: https://github.com/matrix-org/matrix-spec-proposals/pull/1767 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alphapapa says:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Johennes replies: