Skip to content

Commit

Permalink
[IMPROVE] Limit the number of typing users shown (#12400)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinade authored and ggazzo committed Oct 29, 2018
1 parent c07d4a8 commit 773c387
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/rocketchat-ui-message/client/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Template.messageBox.helpers({
},
/* globals MsgTyping*/
usersTyping() {
const maxUsernames = 4;
const users = MsgTyping.get(this._id);
if (users.length === 0) {
return;
Expand All @@ -235,10 +236,10 @@ Template.messageBox.helpers({
};
}
let last = users.pop();
if (users.length > 4) {
if (users.length >= maxUsernames) {
last = t('others');
}
let usernames = users.join(', ');
let usernames = users.slice(0, maxUsernames - 1).join(', ');
usernames = [usernames, last];
return {
multi: true,
Expand Down

0 comments on commit 773c387

Please sign in to comment.