[IMPROVE] Limit the number of typing users shown (#12400)

pull/12368/head^2
Filipe Vinadé 7 years ago committed by Guilherme Gazzo
parent c07d4a829e
commit 773c38724f
  1. 5
      packages/rocketchat-ui-message/client/messageBox.js

@ -223,6 +223,7 @@ Template.messageBox.helpers({
},
/* globals MsgTyping*/
usersTyping() {
const maxUsernames = 4;
const users = MsgTyping.get(this._id);
if (users.length === 0) {
return;
@ -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,

Loading…
Cancel
Save