From abc7edfb31cc91e8c933493215177169c4c239f0 Mon Sep 17 00:00:00 2001 From: Alexey Murz Korepov Date: Mon, 30 Nov 2020 09:56:58 +0300 Subject: [PATCH] Added alternative with attachments after message --- proposals/2881-message-attachments.md | 42 ++++++++++++++++++++------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/proposals/2881-message-attachments.md b/proposals/2881-message-attachments.md index 5e825189b..0e9b80aa9 100644 --- a/proposals/2881-message-attachments.md +++ b/proposals/2881-message-attachments.md @@ -40,12 +40,12 @@ And aggregating event, to send after all message attachments: "body": "Here is my photos and videos from yesterday event", "m.relates_to": [ { - "rel_type": "m.attachment", - "event_id": "$id_of_previosly_send_media_event_1" + "rel_type": "m.attachment", + "event_id": "$id_of_previosly_send_media_event_1" }, { - "rel_type": "m.attachment", - "event_id": "$id_of_previosly_send_media_event_2" + "rel_type": "m.attachment", + "event_id": "$id_of_previosly_send_media_event_2" } ] } @@ -55,16 +55,16 @@ For edits of "message with attachments" we can reuse same "m.relates_to" array v ```json "m.relates_to": [ { - "rel_type": "m.attachment", - "event_id": "$id_of_previosly_send_media_event_1" + "rel_type": "m.attachment", + "event_id": "$id_of_previosly_send_media_event_1" }, { - "rel_type": "m.replace", - "event_id": "$id_of_original event" + "rel_type": "m.replace", + "event_id": "$id_of_original event" }, { - "rel_type": "m.attachment", - "event_id": "$id_of_previosly_send_media_event_2" + "rel_type": "m.attachment", + "event_id": "$id_of_previosly_send_media_event_2" } ] ``` @@ -183,6 +183,28 @@ This way will give less "spam" for room, because when user sends message with 20 4. There are also [MSC2530: Body field as media caption](https://github.com/matrix-org/matrix-doc/pull/2530) but it describes only text description for one media, not several media items, and very similar [MSC2529: Proposal to use existing events as captions for images](https://github.com/matrix-org/matrix-doc/pull/2529) that implement same thing, but via separate event. But if we send several medias grouped as gallery, usually one text description is enough. +5. Other alternative can be posting `m.message` event at first, and link all attachments to it later via `m.relates_to` field, something like this: +```json +{ + "msgtype": "m.image", + "body": "Image 1.jpg", + "info": { + "mimetype": "image/jpg", + "size": 1153501, + "w": 963, + "h": 734, + }, + "m.relates_to": [ + { + "rel_type": "m.attachment_to", + "event_id": "$id_of_main_message" + }, + "url": "mxc://example.com/KUAQOesGECkQTgdtedkftISg" +}, +``` +But this way will give harder way to render of main message event, because Matrix clients must be search all attached events manually in timeline. + + ## Future considerations In future, we may extend the `m.attachments` field with new types to allow attaching external URL as cards with URL preview, oEmbed entities, and other events (for example, to forward the list of several events to other room with the user comment).