diff --git a/client/views/app/room.coffee b/client/views/app/room.coffee
index 1c5235befcc..c3b4cb4f6db 100644
--- a/client/views/app/room.coffee
+++ b/client/views/app/room.coffee
@@ -456,6 +456,13 @@ Template.room.events
# $('.input-message-editing').select()
"click .mention-link": (e) ->
+ channel = $(e.currentTarget).data('channel')
+ if channel?
+ channelObj = ChatSubscription.findOne name: channel
+ if channelObj?
+ FlowRouter.go 'room', {_id: channelObj.rid}
+ return
+
Session.set('flexOpened', true)
Session.set('showUserInfo', $(e.currentTarget).data('username'))
diff --git a/packages/rocketchat-mentions/client.coffee b/packages/rocketchat-mentions/client.coffee
index d26a678eaf5..74097c073b5 100644
--- a/packages/rocketchat-mentions/client.coffee
+++ b/packages/rocketchat-mentions/client.coffee
@@ -11,6 +11,7 @@ class MentionsClient
mentions = []
message.msg.replace /(?:^|\s|\n)(?:@)([A-Za-z0-9-_.]+)/g, (match, mention) ->
mentions.push mention
+
if mentions.length isnt 0
mentions = _.unique mentions
mentions = mentions.join('|')
@@ -24,6 +25,17 @@ class MentionsClient
return match.replace mention, "#{mention}"
+ channels = []
+ message.msg.replace /(?:^|\s|\n)(?:#)([A-Za-z0-9-_.]+)/g, (match, mention) ->
+ channels.push mention
+
+ if channels.length isnt 0
+ channels = _.unique channels
+ channels = channels.join('|')
+ msg = msg.replace new RegExp("(?:^|\\s)(#(#{channels}))(?:\\s|$)", 'g'), (match, mention, channel) ->
+ return match.replace mention, "#{mention}"
+
+
message.html = msg
return message