From 610b2a3a428df410d2549508b2a3f883526c4e3b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 9 Aug 2017 10:40:06 +0100 Subject: [PATCH] For mentions, always use rawDisplayName and remove (IRC) --- src/autocomplete/UserProvider.js | 2 +- src/components/views/rooms/MessageComposerInput.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 5db0369150..69b80dade4 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -62,7 +62,7 @@ export default class UserProvider extends AutocompleteProvider { return { // Length of completion should equal length of text in decorator. draft-js // relies on the length of the entity === length of the text in the decoration. - completion: user.rawDisplayName, + completion: user.rawDisplayName.replace(' (IRC)', ''), suffix: range.start === 0 ? ': ' : ' ', href: 'https://matrix.to/#/' + user.userId, component: ( diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 4e6b57b7f4..b2c1436365 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -269,7 +269,8 @@ export default class MessageComposerInput extends React.Component { // paths for inserting a user pill is not fun const selection = this.state.editorState.getSelection(); const member = this.props.room.getMember(payload.user_id); - const completion = member ? member.name.replace(' (IRC)', '') : payload.user_id; + const completion = member ? + member.rawDisplayName.replace(' (IRC)', '') : payload.user_id; this.setDisplayedCompletion({ completion, selection,