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

Sort VoIP events semantically #1967

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

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Oct 10, 2024

This introduces an x-weight property that can be used to influence the order of events rendered with the event-group shortcode and uses it to put the VoIP events into semantic order.

Fixes: #937

Pull Request Checklist

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

Fixes: matrix-org#937
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
@Johennes Johennes marked this pull request as ready for review October 10, 2024 11:44
@Johennes Johennes requested a review from a team as a code owner October 10, 2024 11:44
{{ $event_data = partial "json-schema/resolve-refs" (dict "schema" $event_data "path" $path) }}
{{ $event_data := partial "json-schema/resolve-allof" $event_data }}
{{/* Render the events sorted by x-weight or otherwise their event name */}}
{{ range sort $events "event_data.x-weight" "event_name" }}
Copy link
Member

Choose a reason for hiding this comment

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

Does this work? It looks like the only thing you can put as the third argument to sort is "asc" or "desc": https://gohugo.io/functions/collections/sort/

@@ -41,3 +41,8 @@ same use as `format`, but that applies to the pattern of the property. We also
define custom values for formats with the `mx-` prefix in
`data/custom-formats.yaml`. Those values are recognized in the rendered
specification and link to the definition of the format.

## Custom `x-weight` key
Copy link
Member

Choose a reason for hiding this comment

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

Unless x-weight is a colloquial identifier, x-sort-weight may be slightly more self-descriptive?

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.

VoIP call events are in a bonkers confusing order
4 participants