File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
ts/components/conversation/message/message-content Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -201,10 +201,24 @@ export const MessageBody = (props: Props) => {
201
201
}
202
202
203
203
if ( window . getSettingValue ( 'message-formatting' ) ) {
204
+ /* Resolve mentioned ids to user names and mark them up in bold */
205
+ const mention = new RegExp ( `@${ PubKey . regexForPubkeys } ` , 'g' ) ;
206
+ const textWithMentions = text . trim ( ) . replace ( mention ,
207
+ ( _match , capture ) => {
208
+ if ( isUsAnySogsFromCache ( capture ) ) {
209
+ /* It's me. Italicise also. */
210
+ return `***@${ window . i18n ( 'you' ) } ***` ;
211
+ }
212
+
213
+ /* It's someone else. */
214
+ return `**@${ getConversationController ( ) . get ( capture ) ?. getContactProfileNameOrShortenedPubKey ( ) || PubKey . shorten ( capture ) } **` ;
215
+ }
216
+ ) ;
217
+
204
218
/* tslint:disable:react-no-dangerous-html */
205
219
return (
206
220
< div className = "text-selectable"
207
- dangerouslySetInnerHTML = { { __html : `<span style="font-size: 1.1em;">${ markdown . render ( text ) . trim ( ) } </span>` } }
221
+ dangerouslySetInnerHTML = { { __html : `<span style="font-size: 1.1em;">${ markdown . render ( textWithMentions ) } </span>` } }
208
222
/>
209
223
) ;
210
224
}
You can’t perform that action at this time.
0 commit comments