The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/packages/rocketchat-ui-message/client/messageBoxTyping.js

33 lines
781 B

import { Template } from 'meteor/templating';
import { MsgTyping } from 'meteor/rocketchat:ui';
import { t } from 'meteor/rocketchat:utils';
import './messageBoxTyping.html';
Template.messageBoxTyping.helpers({
data() {
const maxUsernames = 4;
const users = MsgTyping.get(this.rid);
if (users.length === 0) {
return;
}
if (users.length === 1) {
return {
multi: false,
selfTyping: MsgTyping.selfTyping.get(),
users: users[0],
};
}
let last = users.pop();
if (users.length >= maxUsernames) {
last = t('others');
}
let usernames = users.slice(0, maxUsernames - 1).join(', ');
usernames = [usernames, last];
return {
multi: true,
selfTyping: MsgTyping.selfTyping.get(),
users: usernames.join(` ${ t('and') } `),
};
},
});