habitica/views/options/social/chat-message.jade
Nick Gordon 55998085e3 fixed the issue with case insensitive highlighting highlighting short usernames
how this works:
* rather than throw an expensive regular expression at each chat message, we start by checking to see if the users name exists.
* then, by simple string manipulation we verify that the preceeding character before the alleged username is whitespace, the start of a line, or an '@' character.
* FINALLY, we verify the following character is a non-word character using a regular expression.
* then we cache the highlight status on the local `message` object, because for some reason, this function is called **every time a character is typed in the chatbox.** this seems like a hugh performance problem to me, need to see if there is a way to disable that or something
2013-11-16 09:24:01 -08:00

10 lines
709 B
Text

li(ng-repeat='message in group.chat', ng-class='{highlight: isUserMentioned(user,message), "own-message": user._id == message.uuid}')
a.label.chat-message(class='label-contributor-{{message.contributor.level}}', ng-class='{"label-npc": message.backer.npc}', ng-click='clickMember(message.uuid, true)')
span(tooltip='{{contribText(message.contributor, message.backer)}}') {{message.user}} 
|  
span(ng-bind-html="message.text | linky:'_blank'")
|  - 
span.muted.time
| {{relativeDate(message.timestamp, _currentTime) + ' '}}
a(ng-show='user.contributor.admin || message.uuid == user.id', ng-click='deleteChatMessage(group, message)')
i.icon-remove(tooltip='Delete')