-
Notifications
You must be signed in to change notification settings - Fork 382
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
Attaching data to messages #93
Conversation
type: "m.room.message", | ||
content: { | ||
msgtype: "m.text", | ||
body: "[matrix-org/matrix-ios-sdk] manuroe pushed 4 commits to develop", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is expressive enough to be generally useful. For sure I can see uses, but I think restricting to one entity for the message is limiting.
Slack's API I think has this down pretty well; anything which has more context will be in a <> tag, and the context is on the left of a pipe, e.g.
"Just FYI, <@U1234|manuroe> pushed some commits, yo"
would turn manuroe into a link to the user with ID @U1234, but if your client doesn't understand, it would just print:
"Just FYI, manuroe pushed some commits, yo"
I could imagine having a list of entities in the data or context key, and being able to refer to them by index, e.g.
content: {
body: "Just FYI, manuroe pushed 4 commits to develop",
interpolated_body: "Just FYI, <#1|manuroe> pushed 4 commits to <#2|develop>",
data: {
entities: [
{
"domain": "github.com",
"user": "manuroe",
"link": "https://github.com/manuroe",
},
{
"domain": "github.com",
"repo": "matrix-org/matrix-ios-sdk",
"branch": "develop",
"link": "https://github.com/matrix-org/matrix-ios-sdk/tree/develop",
},
]
}
}
But I think limiting to a top-level context is slightly limiting.
I am not sure how I feel about by default having something which is always interpretable in body, or requiring a separate interpolated_body or something...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Allowing multiple entities and allowing them to associate with specific parts of the message looks very nice - e.g. a Jenkins failure report relating to a git commit would probably have three or four different linkable entities.
I'm a bit confused by this one. Isn't it more idiomatic to just send a custom event type, but with a human-readable body field (and mandate that clients should always display the 'body' param of events they don't recognise)? So the original example here would be something more like: type: "org.matrix.git.commits", Either way, it feels particularly werid that the 'domain' of the context wouldn't be an m.* or org.matrix.* style namespace. Dan's alternative slack-inspired suggestion is interesting, in that I guess it's effectively a richer hyperlink representation. Again, don't see why "domain" param is "github.com" rather than an com.github.* style namespace for the entity. The only thing that feels a little weird is inventing an entirely new hypertext markup language with <foo|bar> style representation for these links (and cargoculting random antics from Slack). What's wrong with HTML? manuroe etc? Otherwise LGTM, although given nothing is screaming out for this i'd rather we prioritised features & bugs on the critical path. I'm also not sure what our policy should really be on landing vapourware spec stuff; I quite like the idea of keeping the spec fairly strictly tracking what we actually have implemented in the reference implementations rather than diverging off into scifi. (This is obviously fine to keep in drafts tho, which is generally scifi HQ! :) |
It is not more idiomatic to do this. Clients everywhere just switch on the event type. If they don't recognise it, they drop it on the floor.
We do
Parsing freeform HTML is at best a pain and extremely error-prone and at worst impossible to do. Dan's list of entities makes parsing much easier.
The moment we want to do anything more complicated than displaying text and images we're going to bump into this problem. Given how quick it was to write, I don't see the problem in asking for feedback from people.
This is precisely why this is in |
Obviously you wouldn't put a content.body on events which make no sense to display as text messages in a timeline.
Why wouldn't you namespace these hints?
Fair point.
Not complaining about it being written at all :) just trying to give review.
yay! |
I don't recall anyone suggesting this (just
I 100% agree. But that is the crux of the problem. You don't know it is a dumb idea to try to display
I feel namespacing them as |
How do I, as a client, interpret the metadata? Do I have to go The reason for namespacing event types and msgtypes is to allow clients to know what keys to expect and what they mean. It also ensures that if two different developers try and implement the same thing (e.g. HTML msgtype) they won't both clash and confuse clients. Take your github.com example, what happens if two different developers try to come up with it at the same time, but using different key names? How do you expect clients to use the metadata? How will it be displayed? How much does it conflict with different |
One thing I wonder is whether some variety of RDF - be it JSON-LD or something else - might be better for metadata. In particular, the namespacing concern falls out quite naturally by way of subjects, objects, and predicates being, well, URIs (or blank nodes, but whatever). |
The discussion on this has progressed and this document is now superseded by https://docs.google.com/document/d/1l08DL_F_CHo1pIORXzcqWLlZQpztogMFUTYmxd4Gr5s |
That document seems to cover the "formatting" side of this ticket, but not the "auxiliary semantic data" side. Should this be reopened, a new ticket opened for that alone, ...? |
@eternaleye : It is covered via:
We do not specify standard keys which will be present in |
The discussion on this has progressed and this document is now superseded by this Google Doc
This is a straw-man proposal detailing how data can be attached to
m.room.messages
to provide a richer experience for knowledgeable clients. I expect this will change a lot, but is being published now to get some feedback.Rendered: https://github.com/matrix-org/matrix-doc/blob/data-messages/drafts/m-room-message-data.rst