diff --git a/packages/rocketchat-lib/client/MessageAction.js b/packages/rocketchat-lib/client/MessageAction.js index 225baa5f4eb1..b61ec1d06850 100644 --- a/packages/rocketchat-lib/client/MessageAction.js +++ b/packages/rocketchat-lib/client/MessageAction.js @@ -114,9 +114,9 @@ Meteor.startup(function() { action() { const message = this._arguments[1]; const {input} = chatMessages[message.rid]; - input.value = `@${ message.u.username } `; $(input) .focus() + .data('mention-user', true) .data('reply', message) .trigger('dataChange'); }, @@ -277,6 +277,7 @@ Meteor.startup(function() { const {input} = chatMessages[message.rid]; $(input) .focus() + .data('mention-user', false) .data('reply', message) .trigger('dataChange'); }, diff --git a/packages/rocketchat-ui/client/lib/chatMessages.js b/packages/rocketchat-ui/client/lib/chatMessages.js index 98a7eeb4e0bf..0014a78189bb 100644 --- a/packages/rocketchat-ui/client/lib/chatMessages.js +++ b/packages/rocketchat-ui/client/lib/chatMessages.js @@ -187,11 +187,13 @@ this.ChatMessages = class ChatMessages { let msg = ''; const reply = $(input).data('reply'); - if (reply!==undefined) { + const mentionUser = $(input).data('mention-user') || false; + + if (reply !== undefined) { const url = RocketChat.MessageAction.getPermaLink(reply._id); msg = `[ ](${ url }) `; const roomInfo = RocketChat.models.Rooms.findOne(reply.rid, { fields: { t: 1 } }); - if (roomInfo.t !== 'd' && reply.u.username !== Meteor.user().username) { + if (roomInfo.t !== 'd' && reply.u.username !== Meteor.user().username && mentionUser) { msg += `@${ reply.u.username } `; } }