Add support for MSC-4144: Per-Message Profiles #82
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: cadence/out-of-your-element#82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "beanie/out-of-your-element:msc4144"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR implements support for using per-message profile data if present in either
com.beeper.per_message_profile(unstable), orm.per_message_profile(stable), updating the displayName and avatarURL as required.If a message contains a fallback, we additionally strip the fallback identity from both the plaintext and formatted HTML components as per the specification.
Completes #59
To address one of the main criticisms I have with that MSC, they make the suggestion of matching specifically this tag:
<strong\s+data-mx-profile-fallback(?:="")?\s*>([^<]+): </strong\s*>I have instead implemented the following, which is safer, handling multi-line input, matching the same closing tag, etc.
This however is not 100% safe, no regular expression is. Personally I'm going to argue for the non-fallback content to be explicitly stated in that MSC, because regex should be used for matching, not content manipulation in matrix client or bridge implementations.
Similarly, trimming the plaintext component also assumes that clients implement the spec accurately as it stands today, and do not deviate. This also cannot be guaranteed.
5d29104deato87fcdb18ab@cadence I'm.. not convinced on the matrix info command changes (more specifically, reflecting the real user that posted it rather than the PMP seems more appropriate) let me know what you think!
I take it back, it looks fine
