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

MSC2557: Proposal to clarify spoilers #2557

Merged
merged 3 commits into from
Mar 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions proposals/2010-spoilers.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@ Sometimes, while you want to put text into a spoiler to not have people accident

For example, when discussing a new movie or a TV series, not everyone might have watched it yet.
In such cases it would make sense to add a spoiler so that only those who have seen the movie or
don't mind spoilers read the content.
don't mind spoilers read the content.
Another example would be e.g. in mental health communities where certain people have certain
triggers. People could put talking about abuse or the like into a spoiler, to not accidentally
trigger anyone just reading along the conversation.
trigger anyone just reading along the conversation.
Furthermore this is helpful for bridging to other networks that already have a spoiler feature.

To render the spoiler the content is hidden and then revealed once interacted somehow
(e.g. a click / hover).

## Proposal
This proposal is about adding a new attribute to the `formatted_body` of messages with type
`m.room.message` and msgtype `m.text`.
`m.room.message` and message types which support the `org.matrix.custom.html` format.

It adds a new attribute, `data-mx-spoiler`, to the `<span>` tag. If the attribute is present the
contents of the span tag should be rendered as a spoiler. Optionally, you can specify a reason for
the spoiler by setting the attribute string. It could be rendered, for example, similar to this:

![Spoiler rendering idea](images/2010-spoiler-example.gif)

The plaintext fallback supported by the `body` is optional. A recommendation for clients is included
below.

To preserve the semantics of a spoiler in the plaintext fallback it is recommended to upload the contents of the spoiler
as a text file and then link this: `[Spoiler](mxc://someserver/somefile)` and
`[Spoiler for reason](mxc://someserver/somefile)` respectively.
Expand Down
20 changes: 20 additions & 0 deletions proposals/2557-spoiler-clarifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# MSC2557: Clarifications on spoilers

Spoiler messages are described in [MSC2010](https://github.com/matrix-org/matrix-doc/pull/2010)
though the MSC is unclear if the fallback is required to be sent by clients.

## Proposal

The fallback for spoiler messages is optional, though recommended to be sent by clients. Clients
should make reasonable efforts to represent the spoiler in the `body` field of a message.

The recommended fallback format is unchanged.

Additionally, this proposal opens up spoilers to any HTML-supporting message types. Currently
this includes `m.text` (already included by MSC2010), `m.notice`, and `m.emote`.
Copy link
Contributor

Choose a reason for hiding this comment

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

With #2241 that would also include m.key.verification.request

Copy link
Member Author

Choose a reason for hiding this comment

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

No? It doesn't require HTML.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, it does it's just buried in the MSC. That's probably fine still - "don't be silly" clauses start to take effect in the spec.

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't require it, but it is optional. Although, as you said "HTML-supporting message types" that would be covered, too


## Potential issues

Clients could inadvertently spoil parts of a message by not representing the spoiler correctly
in the `body` of the message. The author believes this would quickly show up as a bug report
on the client due to the nature of spoilers.