element-hq / element-meta

Shared/meta documentation and project artefacts for Element clients
65 stars 11 forks source link

Implement displaying MSC2010 spoiler text in EX #2424

Open ara4n opened 1 month ago

ara4n commented 1 month ago

Your use case

What would you like to do?

If someone sends a msg hidden in a spoiler tag, EX shows it to the user without blurring or obfuscation, spoiling the spoiler.

Why would you like to do it?

Users expect consistent spoiler semantics throughout Matrix. EX breaks that currently.

How would you like to achieve it?

Implement https://spec.matrix.org/unstable/client-server-api/#spoiler-messages

In push notifs and msg previews, no changes needed as spoilers should be rendered using the plaintext fallback, which already elides the spoiler content.

In the timeline: blur <span data-mx-spoiler>lived happily ever after</span> or replace it with a placeholder span whose body is the contents of the data-mx-spoiler attribute. Tapping on the spoiler would reveal the actual content.

Separately, at some point in future we could implement actually composing them in the RTE.

Have you considered any alternatives?

Not doing it, given it's not something Element's enterprise customers care about.

However, it just pisses off people using Element X for generic Matrix communication if spoilers aren't upheld.

Additional context

This wrecked a F1 race result for @Cadair

Cadair commented 1 month ago

I think I saw the content in a push notif as well :thinking: I shall test.

ara4n commented 1 month ago

there may separately be a bug if EX is calculating room previews or push notifs from the rich text representation rather than using the plain text fallback

Cadair commented 1 month ago

I just tested this, and I see the content of spoilers in the push notifications in EX-A. The plain text fallback of a spoiler message sent from EW contains the spoiler text.

content": {
        "body": "@cadair:cadair.com  test",
        "format": "org.matrix.custom.html",
        "formatted_body": "<span data-mx-spoiler>@cadair:cadair.com  test</span>",
[...]
}
ara4n commented 1 month ago

sounds like a bug in EW not being compliant with the spirit of the spec, then:

The fallback SHOULD NOT include the text containing spoilers since body might show up in text-only clients or in notifications.

Bit annoying that the spec says SHOULD rather than MUST.

Cadair commented 1 month ago

I had also just come to that conclusion. MOAR ISSUES.

Cadair commented 1 month ago

I guess it's this: https://github.com/element-hq/element-meta/issues/1634