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

improve display of event subtypes #1283

Merged
merged 5 commits into from Nov 2, 2022
Merged

Conversation

uhoreg
Copy link
Member

@uhoreg uhoreg commented Oct 12, 2022

improvements to m.<event type>$<subtype> events

  • examples are now shown under the subtype. In addition, m.room.message only shows one example, rather than a whole bunch
  • allow setting the title to something that looks more sensible

fixes #815

Preview: https://pr1283--matrix-spec-previews.netlify.app

@uhoreg uhoreg marked this pull request as ready for review October 12, 2022 20:06
@uhoreg uhoreg requested a review from a team as a code owner October 12, 2022 20:06
@richvdh richvdh self-requested a review October 18, 2022 17:03
@@ -736,7 +736,7 @@ following error codes are used in addition to those already specified:
- `m.mismatched_commitment`: The hash commitment did not match.
- `m.mismatched_sas`: The SAS did not match.

{{% event event="m.key.verification.start$m.sas.v1" %}}
{{% event event="m.key.verification.start$m.sas.v1" title="`m.key.verification.start` with `method: m.sas.v1`" %}}
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to put this title in the definition itself? jsonschema defines a title attribute which seems like it would be ideal (https://json-schema.org/draft/2020-12/json-schema-validation.html#name-title-and-description)

Copy link
Member Author

Choose a reason for hiding this comment

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

mainly because some event definitions already use the title attribute (e.g. https://github.com/matrix-org/matrix-spec/blob/main/data/event-schemas/schema/m.room.power_levels.yaml) and set it to something other than what the current title is in the spec.

Copy link
Member

Choose a reason for hiding this comment

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

The example you give looks like it should be the description rather than the title.

Given we know that none of the titles are rendered, maybe we just rip out the existing ones with no loss of value?

Sorry to make the job (even) bigger, but I feel like this is going to be a maintenance headache we should just solve rather than hack around for now

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried doing this, and ran into a snag. All the events inherit (using allOf, usually indirectly) from core-event-schema/event.yaml, so I need to remove all the title properties from everything in the chain. However, removing the title property from event.yaml turns things like

image

becomes

image

☹️

The only way I can think of to actually get this to work the way we want it to is to modify all the event yaml files to have a title property set to the event type (e.g. title: m.room.message in m.room.message.yaml), which seem ... suboptimal.

Copy link
Member

Choose a reason for hiding this comment

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

ugh what a pain in the butt.

It feels like really the problem here is that things like this shouldn't be referring to event.yaml anyway, and should use a more specific type (with an appropriate title).

image

(see also my complaints at #897)

... however, maybe fixing that right now is a bit out of scope and we should just stick with your original suggestion.

layouts/partials/events/render-event.html Outdated Show resolved Hide resolved
layouts/partials/events/example.html Outdated Show resolved Hide resolved
layouts/partials/events/render-event.html Outdated Show resolved Hide resolved
layouts/partials/events/render-event.html Outdated Show resolved Hide resolved
layouts/partials/events/render-event.html Show resolved Hide resolved
@uhoreg uhoreg requested a review from richvdh October 28, 2022 20:37
layouts/partials/events/example.html Outdated Show resolved Hide resolved
layouts/partials/events/render-event.html Outdated Show resolved Hide resolved
layouts/shortcodes/event.html Show resolved Hide resolved
@uhoreg uhoreg requested a review from richvdh November 1, 2022 16:12
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

thanks for your perseverence ❤️

@uhoreg uhoreg merged commit 82d2dd4 into matrix-org:main Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The example for m.key.verification.start$m.sas.v1 appears under m.key.verification.start
2 participants