-
Notifications
You must be signed in to change notification settings - Fork 152
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
Use localpart in plaintext so we get highlighted for pills #658
Changes from 1 commit
0d52d37
e15ff60
bb8649f
7bde9d7
e6facc5
7790377
f830415
7dbee49
0c08853
1e12084
6d4901f
6fce830
adeb5fe
0e7930e
57ad38e
f7a3419
f698081
d2abf26
7faeb2b
2509712
402e674
0580ff2
8686f87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,10 +64,18 @@ MatrixAction.prototype.formatMentions = function(nickUserIdMap) { | |
this.htmlText = this.text; | ||
} | ||
userId = ircFormatting.escapeHtmlChars(userId); | ||
/* Due to how Riot and friends do push notifications, we need the plain text to match something. | ||
Modern client's will pill-ify and will show a displayname, so we can use the localpart so it | ||
matches and doesn't degrade too badly on limited clients.*/ | ||
const localpart = userId.substr(1, userId.indexOf(":")-1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should be using the display name, as per matrix-org/matrix-spec-proposals#1547 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You really want to do a displayname lookup for every match? The localparts already match. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer it if the cached display name was used, given we already know about the member event. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we do know about the mem...OH you mean the member cache thingatron? |
||
this.htmlText = this.htmlText.replace( | ||
new RegExp(escapeStringRegexp(matchName), "igm"), | ||
`<a href="https://matrix.to/#/${userId}">${ircFormatting.escapeHtmlChars(matchName)}</a>` | ||
); | ||
this.text = this.text.replace( | ||
new RegExp(escapeStringRegexp(matchName), "igm"), | ||
localpart | ||
); | ||
// Don't match this name twice, we've already replaced all entries. | ||
matched.add(matchName.toLowerCase()); | ||
} | ||
|
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.
minor: double space after
matches