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

MSC3765: Rich text in room topics #3765

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

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Apr 3, 2022

Rendered

Implementations:


In line with matrix-org/matrix-spec#1700, the following disclosure applies:

I am a Systems Architect at gematik, Software Engineer at Unomed, Matrix community member and former Element employee. This proposal was written and published with my community member hat on.


FCP tickyboxes

Signed-off-by: Johannes Marbach <johannesm@element.io>
@Johennes Johennes changed the title MSC3677: Rich text in room topics MSC3765: Rich text in room topics Apr 3, 2022
@turt2live turt2live added proposal-in-review proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff labels Apr 3, 2022
@alphapapa

This comment was marked as duplicate.

@Johennes

This comment was marked as duplicate.

@emorrp1

This comment was marked as duplicate.

@@ -0,0 +1,96 @@
# MSC3765: Rich text in room topics
Copy link
Member

Choose a reason for hiding this comment

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

@alphapapa says:

On one hand, I can see some elegance in repurposing room topics for general-purpose, long-term room reference information. OTOH, it seems like overloading the purpose of topics with what, in other systems, would go in "pinned" topics or messages, or a wiki, etc.

So IMHO I would consider implementing support for pinned messages/events before overloading topics like this. It would seem relatively straightforward for a room's state to have a list of pinned events, which could be sent in initial sync by the server or be retrieved manually by clients. Clients could then display these pinned events in a room's timeline view, optionally hiding them, compressing them, etc. And the pinned events could be edited by room moderators using existing event-editing tools. (Forgive me if there's already a proposal for something like that.)

Copy link
Member

Choose a reason for hiding this comment

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

@Johennes replies:

Interesting idea. Pinned events seem to already exist. However, in their current form, these are not fit to be used for what you describe because, depending on room settings, users joining the room after the events were sent could be unable to see them.

@turt2live
Copy link
Member

@alphapapa and others: please use threads on the diff to have your comments considered. This can be done by adding a line comment.

If there's no obvious line for where to put a comment, please use the line containing the title.

@tmonz
Copy link

tmonz commented Feb 2, 2024

Sorry, I'm not currently able to follow through on this myself. However, if you're interested, you could adopt ownership over this MSC.

what would be the work that needs to be done? time effort? skills necessary? ...

@Johennes
Copy link
Contributor Author

Johennes commented Feb 2, 2024

The unresolved comments need to be addressed and afterwards I think it could be sent through FCP which might yield further comments.

Update (2024-02-23): I've resolved the remaining comments and raised the proposal with the SCT.

@famfop
Copy link

famfop commented Aug 26, 2024

Hi, what is the state about this PR? AFAIK, Markdown in Room topics (my use-case) is not yet supported. This conversation looks like everything looks good, is there anything stopping it from getting merged?

@tmonz
Copy link

tmonz commented Aug 26, 2024

it has been added to development/nightly, and seems to be working there flawlessly for a long time - from my own testing

proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

Overall the MSC looks pretty good. In my opinion, once the backwards compatibility (old room versions) thread is resolved, this should be ready for FCP. Let us know in the SCT Office once that's been done, as we might miss the github notification (sorry).

proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
@turt2live
Copy link
Member

@mscbot fcp merge

@mscbot
Copy link
Collaborator

mscbot commented Oct 22, 2024

Team member @mscbot has proposed to merge this. The next step is review by the rest of the tagged people:

Concerns:

  • binds behaviour of future unspecified versions

Once at least 75% of reviewers approve (and there are no outstanding concerns), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for information about what commands tagged team members can give me.

@mscbot mscbot added proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. disposition-merge labels Oct 22, 2024
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.

Not a blocking concern but it would be great to polish the wording a little.

text topic is sufficient such as the public rooms directory.

In order to prevent formatting abuse in room topics, clients are
encouraged to limit the length of topics to at most two lines. Additionally,
Copy link
Member

Choose a reason for hiding this comment

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

At most two HTML lines? Or if one crafts a very long plain text topic that would be wrapped into more than two lines that should be limited as well?

I understand where this comes from but in its current reading the recommendation is a bit confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I meant is two displayed lines – regardless of whether the lines resulted from actual newlines in the topic or from a long topic being wrapped onto multiple lines for display.

Does that make sense and if so, do you think "limit the length of topics to at most two displayed lines" would make this clearer?

Copy link
Member

Choose a reason for hiding this comment

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

It might make sense to just say that clients should be sure to limit it, e.g. by limiting the number of displayed lines.

In [`/_matrix/client/v3/createRoom`], the `topic` parameter causes `m.topic`
to be written with a `text/plain` mimetype. If an `m.topic` event is supplied
in `initial_state`, the `topic` parameter overwrites its `text/plain` mimetype
but retains any other mimetypes.
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a footgunny way to end up with a text and html part that don't match. I would expect specifying a topic event in initial_state would take precedence completely rather than require the server to edit parts of the event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, that sounds sensible but then we'd have to swap the order of steps 6 and 7 in https://spec.matrix.org/v1.12/client-server-api/#post_matrixclientv3createroom depending on the room version?

Copy link
Member

Choose a reason for hiding this comment

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

Ah yep, good point. It feels like the right answer to me.

Copy link
Member

Choose a reason for hiding this comment

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

If we want to preserve the current behaviour, then it seems to me like it would be better to have the topic parameter overwrite the whole m.topic event.


It is recommended that clients always include a plain text variant when
sending `m.topic` events. This prevents bad UX in situations where a plain
text topic is sufficient such as the public rooms directory.
Copy link
Member

Choose a reason for hiding this comment

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

Not a blocker but this feels like an odd example as I don't see what the public room directory would necessarily choose not to use rich text. Text-only clients maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blocking on https://github.com/matrix-org/matrix-spec-proposals/pull/3765/files#r1812651036 where we're discussing whether we'll include all mime types everywhere. If so, this would make this whole paragraph obsolete.

text topic is sufficient such as the public rooms directory.

In order to prevent formatting abuse in room topics, clients are
encouraged to limit the length of topics to at most two lines. Additionally,
Copy link
Member

Choose a reason for hiding this comment

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

At both entry and display time presumably?

A plain text topic is sufficient here because this data is commonly
only displayed to users that are *not* a member of the room yet. These
users don't have the same need for rich room topics as users who already
reside in the room.
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I see why you might say this but I'm not sure I agree, and this is going to mean the public room list topics are full of weird looking markdown syntax. I'm inclined to think that if we want topics to be HTML, they ought to be HTML everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could maybe achieve that by cutting a new version of the endpoint and including all mimetypes in the topic field (similar to m.text in the event itself)?

{
  "chunk": [
    {
      "avatar_url": "mxc://bleecker.street/CHEDDARandBRIE",
      "name": "CHEESE",
      "topic": [{
          "body": "All about **cheese**"
      }, {
          "mimetype": "text/html",
          "body": "All about <b>cheese</b>"
      }],
      ...
    }
  ],
  ...
}

This would also have to be applied to the SS endpoints as well as the space hierarchy endpoints. I had not considered this so far because it felt slightly invasive. I agree that it's a bit odd to not have rich topics everywhere though.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this would feel quite reasonable. It could be left for a separate MSC though, so this MSC ends up being the same technically, just with a, "public rooms list doesn't support html topics yet" rather than, "we've decided that public room list doesn't support html topics".

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think that it's reasonable to not want to change those endpoints at this time, but the current wording makes it sound like we don't ever want to change it to support rich-text topics. I think that tweaking the wording here (possibly just by adding something like "A future MSC may update these endpoints to support rich text topics.") would be helpful.

proposals/3765-rich-room-topics.md Outdated Show resolved Hide resolved
@tulir tulir mentioned this pull request Oct 26, 2024
Co-authored-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Comment on lines +69 to +72
A plain text topic is sufficient here because this data is commonly
only displayed to users that are *not* a member of the room yet. These
users don't have the same need for rich room topics as users who already
reside in the room.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
A plain text topic is sufficient here because this data is commonly
only displayed to users that are *not* a member of the room yet. These
users don't have the same need for rich room topics as users who already
reside in the room.
A plain text topic is sufficient here because this data is commonly
only displayed to users that are *not* a member of the room yet. These
users don't commonly have the same need for rich room topics as users
who already reside in the room. A future MSC may update these endpoints
to support rich text topics.

@dbkr / @uhoreg does this sound better and if so, could one of you apply it in my stead?

Copy link
Member

Choose a reason for hiding this comment

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

lgtm

Comment on lines +61 to +64
In [`/_matrix/client/v3/createRoom`], the `topic` parameter causes `m.topic`
to be written with a `text/plain` mimetype. If an `m.topic` event is supplied
in `initial_state`, the `topic` parameter overwrites its `text/plain` mimetype
but retains any other mimetypes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we want to preserve the current behaviour, then it seems to me like it would be better to have the topic parameter overwrite the whole m.topic event.

I think I like that best as it's quite easy to do and may still be improved by a future MSC generalizing (or possibly even eliminating) the topic parameter.

@dbkr / @uhoreg how does this sound?

Suggested change
In [`/_matrix/client/v3/createRoom`], the `topic` parameter causes `m.topic`
to be written with a `text/plain` mimetype. If an `m.topic` event is supplied
in `initial_state`, the `topic` parameter overwrites its `text/plain` mimetype
but retains any other mimetypes.
In [`/_matrix/client/v3/createRoom`], the `topic` parameter causes `m.topic`
to be written with a `text/plain` mimetype. If at the same time an `m.topic`
event is supplied in `initial_state`, it is overwritten entirely. A future MSC
may generalize the `topic` parameter to allow specifying other mime types
without `initial_state`.

Copy link
Member

Choose a reason for hiding this comment

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

lgtm. @dbkr any objections?

Co-authored-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Comment on lines +16 to +20
Drawing from extensible events as described in [MSC1767], `m.room.topic`
is prohibited in room versions that support extensible events and replaced
with a new `m.topic` event type. The latter contains a new content block
`m.topic` which wraps an `m.text` content block that allows representing
the room topic in different mime types.
Copy link
Member

Choose a reason for hiding this comment

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

I read this and thought "well, since there are no current room versions that support extensible events, we're not going to be able to use this anywhere".

Having read through a bit more and come across the "Transition" and "Notes" sections, I realise that's not really the case.

What's more: I am worried that any behaviour defined here for some mythical extensible-events-supporting room version is going to be forgotten by the time we actually come to define such a room version; and then we will find ourselves very confused about what is or is not specced. I would strongly argue that we should limit this proposal to the room versions we have today, with some non-normative suggestions about how how things might look in future room versions.

In other words: let's rephrase this a bit.

Suggested change
Drawing from extensible events as described in [MSC1767], `m.room.topic`
is prohibited in room versions that support extensible events and replaced
with a new `m.topic` event type. The latter contains a new content block
`m.topic` which wraps an `m.text` content block that allows representing
the room topic in different mime types.
Drawing from extensible events as described in [MSC1767], a new content block
`m.topic` is defined, which wraps an `m.text` content block that allows representing
the room topic in different mime types.
In current room versions, this content block is added to the content of
[`m.room.topic`](https://spec.matrix.org/v1.12/client-server-api/#mroomtopic) events as shown below.
See also (link to separate section) which discusses possible adoption in future room versions which
support extensible events.

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively: we don't have to wait for the whole of extensible events to land to make m.topic events a thing: it's not even clear we need a new room version. (Room versions have historically focussed on server-side functionality, whereas topics are more a client-side thing. Clients generally accept unknown room versions and muddle through as best they can.)

Anyway, the point here is that there are options here. Let's just not define behaviour for a room version so far away that we'll forget about this in the meantime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It sounds like this would mean rebasing this proposal onto the current spec (which doesn't know extensible events) and then creating another proposal to adapt it to the extensible events room version later?

I'd be ok with that but I feel like I'm being bounced back and forth a little here. @turt2live this would probably benefit from your input.

@richvdh I guess you might want to stick up a concern?

Comment on lines +22 to +38
``` json5
{
"type": "m.topic",
"state_key": "",
"content": {
"m.topic": {
"m.text": [{
"body": "All about **pizza** | [Recipes](https://recipes.pizza.net)"
}, {
"mimetype": "text/html",
"body": "All about <b>pizza</b> | <a href=\"https://recipes.pizza.net\">Recipes</a>"
}]
}
},
...
}
```
Copy link
Member

Choose a reason for hiding this comment

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

replace with example of m.room.topic event

@richvdh
Copy link
Member

richvdh commented Nov 6, 2024

@mscbot concern binds behaviour of future unspecified versions

@mscbot mscbot added the unresolved-concerns This proposal has at least one outstanding concern label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API disposition-merge kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the final comment period. unresolved-concerns This proposal has at least one outstanding concern
Projects
Status: Ready for FCP ticks
Development

Successfully merging this pull request may close these issues.