Skip to content

Commit

Permalink
Updated nick extraction regex and mentioned user formatting regex so …
Browse files Browse the repository at this point in the history
…we highlight greentext usernames.
  • Loading branch information
kyrunadev committed Apr 10, 2024
1 parent 96560e8 commit a2b14cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/chat/js/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function buildSearchCriteria(str, offset) {
if (endCaret > -1) post = post.substring(0, endCaret);

// Ignore the first char as part of the search and flag as a user only search
if (pre.lastIndexOf('@') === 0) {
if (pre.lastIndexOf('@') === 0 || pre.lastIndexOf('>') === 0) {
startCaret += 1;
pre = pre.substring(1);
useronly = true;
Expand Down
2 changes: 1 addition & 1 deletion assets/chat/js/formatters/MentionedUserFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default class MentionedUserFormatter {
if (message && message.mentioned && message.mentioned.length > 0) {
return str.replace(
new RegExp(
`((?:^|\\s)@?)(${message.mentioned.join('|')})(?=$|\\s|[.?!,'])`,
`((?:^|\\s)@?|>)(${message.mentioned.join('|')})(?=$|\\s|[.?!,'])`,
'igm',
),
`$1<span class="chat-user">$2</span>`,
Expand Down
2 changes: 1 addition & 1 deletion assets/chat/js/regex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2b14cc

Please sign in to comment.