matrix-commander icon indicating copy to clipboard operation
matrix-commander copied to clipboard

Question: `template-msc` number for `Reply` (not `in thread`)?

Open Benjamin-Loison opened this issue 2 years ago • 2 comments

I would like to contribute by adding a template for Reply (not in thread), as suggested:

https://github.com/8go/matrix-commander/blob/79a5d0c2db9b3c49de0d0538affbe07f1a266f84/event-templates/README.md?plain=1#L21-L23

While I know how to get the correct JSON payload to send, I do not know how to get its template-msc number, even with matrix-spec-proposals.

Example of such a payload according to Element desktop:

{
  "type": "m.room.message",
  "content": {
    "msgtype": "m.text",
    "body": "> <@benjamin_loison:matrix.org> INITIAL_MESSAGE\n\nANSWER_MESSAGE",
    "format": "org.matrix.custom.html",
    "formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!CENSORED_0:matrix.org/$CENSORED_1?via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@benjamin_loison:matrix.org\">@benjamin_loison:matrix.org</a><br>INITIAL_MESSAGE</blockquote></mx-reply>nANSWER_MESSAGE",
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "$CENSORED_1"
      }
    }
  }
}

Giving me the correct template-msc number and explaining me how you found it would help me to contribute :)

Benjamin-Loison avatar Nov 22 '23 02:11 Benjamin-Loison

Here is a list of MSCs https://github.com/matrix-org/matrix-spec-proposals/tree/main/proposals

The name summarizes what the MSC is roughly about: e.g. https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/2676-message-editing.md tells you that MSC 2676 is about message editing.

Inside in the detailed description of an MSC you might find a JSON outline like this:

{
    "type": "m.room.message",
    "content": {
        "body": "* Hello! My name is bar",
        "msgtype": "m.text",
        "m.new_content": {
            "body": "Hello! My name is bar",
            "msgtype": "m.text"
        },
        "m.relates_to": {
            "rel_type": "m.replace",
            "event_id": "$some_event_id"
        }
    }
}

Does this help you a step further ?

You can do searches:

Go to: https://github.com/matrix-org/matrix-spec-proposals/tree/main/proposals

In your example above, there was a JSON field: m.relates_to. You might want to search for m.relates_to.

There is a search box on top right of page: enter search term there.

Full search term is: "repo:matrix-org/matrix-spec-proposals m.relates_to"

It gives you all the MSCs that have that field.

This way you can narrow down which MSC exactly it is and what event you exactly want to create.

Please keep us posted if this helps and what you found out. Cheers.

Thanks for trying to contribute :rocket: :clap:

8go avatar May 02 '24 13:05 8go

In fact, according to Element desktop, it seems that my initial event source can be minimized to:

{
  "type": "m.room.message",
  "content": {
    "msgtype": "m.text",
    "body": "ANSWER_MESSAGE",
    "format": "org.matrix.custom.html",
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "$INITIAL_MESSAGE_ID"
      }
    }
  }
}

It is still unclear what template-msc number would be appropriate:

grep -rwl 'in_reply_to' -m 1
proposals/3952-intentional-mentions.md
proposals/3676-transitioning-away-from-reply-fallbacks.md
proposals/2674-event-relationships.md
proposals/2676-message-editing.md
proposals/3440-threading-via-relations.md

Assuming that matrix-commander/tree/078da5f16c9b94893939ad19a21677f84a8625f9/event-templates are specific to a given proposal, then only the first 3 proposals seem relevant. Based on in_reply_to occurrences, only the second seems quite relevant but in fact it is does not seem to introduce in_reply_to.

Benjamin-Loison avatar May 11 '24 00:05 Benjamin-Loison