-
Notifications
You must be signed in to change notification settings - Fork 450
MSC4461: Storing per-message profiles for users #4461
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
Open
tulir
wants to merge
12
commits into
main
Choose a base branch
from
tulir/per-message-profile-storage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+153
−0
Open
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c42d95a
MSC4461: Storing per-message profiles for users
tulir 61aec70
Use an array with a list of triggers instead of a map
tulir dd14289
Adjust example
tulir 78fce3d
Clarify that the prefix is removed
tulir baef68e
Define prefixes to be case-sensitive
tulir 047ad05
Specify that triggers are optional
tulir 8a8cfa7
Remove outdated details
tulir 51d4265
Add per-room event and suffix triggers
tulir 4828f27
,
tulir 5e8170c
Expand on alternatives
tulir 93e9c3c
Add keep_trigger option
tulir 0782351
Fix typo
tulir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # MSC4461: Storing per-message profiles for users | ||
| [MSC4144] introduces per-message profiles, which allow users and bots to | ||
| override their profile info for a single message. The original use case was | ||
| primarily bots, but the feature is useful for humans too. However, humans don't | ||
| like re-entering their profile info every time they send a message. Therefore, | ||
| a method for storing reusable profiles is needed. | ||
|
|
||
| [MSC4144]: https://github.com/matrix-org/matrix-spec-proposals/pull/4144 | ||
|
|
||
| ## Proposal | ||
| A new `m.per_message_profiles` account data event is introduced. The event | ||
| content is a map from a user-defined profile "shortcode" to the per-message | ||
| profile data that gets sent in events. All fields inside the profile object | ||
| are defined by [MSC4144]. | ||
|
|
||
| The shortcode is an arbitrary user-defined string, which can be used as a key | ||
| when selecting a profile to use. Arbitrary unicode is allowed, but spaces | ||
| SHOULD NOT be used, as clients that use a command-based UI might split | ||
| parameters on spaces. | ||
|
|
||
| ```json | ||
| { | ||
| "type": "m.per_message_profiles", | ||
| "content": { | ||
| "meow": { | ||
| "id": "cat", | ||
| "displayname": "Cat 🐈️" | ||
| }, | ||
| "mrrp": { | ||
| "id": "black_cat", | ||
| "displayname": "🐈⬛", | ||
| "avatar_url": "mxc://maunium.net/hgXsKqlmRfpKvCZdUoWDkFQo" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| A client could then have a `/profile` command to pick a profile when sending | ||
| a message, such that `/profile mrrp hello` turns into | ||
|
|
||
| ``` | ||
| { | ||
| "type": "m.room.message", | ||
| "content": { | ||
| "msgtype": "m.text", | ||
| "body": "🐈⬛: hello", | ||
| "format": "org.matrix.custom.html", | ||
| "formatted_body": "<p><strong data-mx-profile-fallback>🐈⬛: </strong>hello</p>", | ||
| "m.per_message_profile": { | ||
| "id": "black_cat", | ||
| "displayname": "🐈⬛", | ||
| "avatar_url": "mxc://maunium.net/hgXsKqlmRfpKvCZdUoWDkFQo", | ||
| "has_fallback": true | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Potential issues | ||
| Users with lots of profiles can end up with a large account data event, but | ||
| it's unlikely to be larger than existing big account data like push rules or | ||
| `m.direct`. | ||
|
|
||
| Since it's a single account data event, editing can hit race conditions. It's | ||
| likely not a problem, as it's only edited directly by humans (as opposed to | ||
| something like `m.direct`, which clients may update in the background). | ||
|
|
||
| ## Alternatives | ||
| There are various other places where profiles could be stored, like | ||
|
tulir marked this conversation as resolved.
Outdated
|
||
| [rooms](https://github.com/matrix-org/matrix-spec-proposals/pull/4201) | ||
| or multiple account data events. This proposal uses a single account | ||
| data event for simplicity. | ||
|
|
||
| ## Security considerations | ||
| This proposal only adds a way to store reusable profile data. | ||
| Security considerations with per-message profiles are covered in [MSC4144] | ||
|
|
||
| ## Unstable prefix | ||
| `fi.mau.msc4461.per_message_profiles` can be used instead of | ||
| `m.per_message_profiles` in global account data. | ||
|
|
||
| ## Dependencies | ||
| This MSC builds on [MSC4144], which at the time of writing has not yet been | ||
| accepted into the spec. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Implementation requirements:
Uh oh!
There was an error while loading. Please reload this page.
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.
gomuks/gomuks@2e5489a (+ gomuks/gomuks@4daa127 and gomuks/gomuks@fbe6fdb) is an implementation of sending profiles, no UI for creating yet
gomuks/gomuks@951bac5 updates the implementation to the v2 format added in 61aec70
gomuks/gomuks@c416f43 updates it to v3