diff --git a/packages/rocketchat-authorization/client/views/permissionsRole.coffee b/packages/rocketchat-authorization/client/views/permissionsRole.coffee index b2636fa18a9a..d39e1bbb638a 100644 --- a/packages/rocketchat-authorization/client/views/permissionsRole.coffee +++ b/packages/rocketchat-authorization/client/views/permissionsRole.coffee @@ -60,7 +60,7 @@ Template.permissionsRole.helpers filter: exceptions: Template.instance().usersInRole.get()?.fetch() selector: (match) -> - return { username: match } + return { term: match } sort: 'username' } ] diff --git a/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.coffee b/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.coffee index 340e100de6e2..7d3e047ef1ba 100644 --- a/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.coffee +++ b/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.coffee @@ -23,7 +23,7 @@ Template.mailMessagesInstructions.helpers filter: exceptions: Template.instance().selectedUsers.get() selector: (match) -> - return { username: match } + return { term: match } sort: 'username' } ] diff --git a/packages/rocketchat-lib/server/models/Users.coffee b/packages/rocketchat-lib/server/models/Users.coffee index 6a79b181d477..ce57023e2394 100644 --- a/packages/rocketchat-lib/server/models/Users.coffee +++ b/packages/rocketchat-lib/server/models/Users.coffee @@ -84,16 +84,24 @@ RocketChat.models.Users = new class extends RocketChat.models._Base return @find query, options - findActiveByUsernameRegexWithExceptions: (username, exceptions = [], options = {}) -> + findActiveByUsernameOrNameRegexWithExceptions: (searchTerm, exceptions = [], options = {}) -> if not _.isArray exceptions exceptions = [ exceptions ] - usernameRegex = new RegExp username, "i" + termRegex = new RegExp searchTerm, "i" query = $and: [ { active: true } - { username: { $nin: exceptions } } - { username: usernameRegex } + {'$or': [ + {'$and': [ + { username: { $nin: exceptions } } + { username: termRegex } + ]} + {'$and': [ + { name: { $nin: exceptions } } + { name: termRegex } + ]} + ]} ] type: $in: ['user', 'bot'] @@ -150,6 +158,9 @@ RocketChat.models.Users = new class extends RocketChat.models._Base return @find(query, options)?.fetch?()?[0]?.lastLogin + getDisplayName: (_id) -> + return "display name" + findUsersByUsernames: (usernames, options) -> query = username: diff --git a/packages/rocketchat-livechat/app/client/views/message.html b/packages/rocketchat-livechat/app/client/views/message.html index 357dd077df9c..5340b77e1308 100644 --- a/packages/rocketchat-livechat/app/client/views/message.html +++ b/packages/rocketchat-livechat/app/client/views/message.html @@ -9,7 +9,7 @@ {{/if}}
- {{{body}}} + {{{body}}} dasds
diff --git a/packages/rocketchat-ui-flextab/flex-tab/tabs/membersList.coffee b/packages/rocketchat-ui-flextab/flex-tab/tabs/membersList.coffee index a990245f4bb8..438de4943f63 100644 --- a/packages/rocketchat-ui-flextab/flex-tab/tabs/membersList.coffee +++ b/packages/rocketchat-ui-flextab/flex-tab/tabs/membersList.coffee @@ -72,9 +72,9 @@ Template.membersList.helpers noMatchTemplate: Template.userSearchEmpty matchAll: true filter: - exceptions: [Meteor.user().username] + exceptions: [Meteor.user().username, Meteor.user().name] selector: (match) -> - return { username: match } + return { term: match } sort: 'username' } ] diff --git a/packages/rocketchat-ui-message/message/message.html b/packages/rocketchat-ui-message/message/message.html index 895831b9dd86..12087fd8c87e 100644 --- a/packages/rocketchat-ui-message/message/message.html +++ b/packages/rocketchat-ui-message/message/message.html @@ -4,7 +4,7 @@ {{#if avatarFromUsername}} {{else}} -