mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Do not show "+1 other"
Instead show a user name or avatar.
This commit is contained in:
parent
553054409f
commit
103710728f
3 changed files with 12 additions and 7 deletions
|
@ -49,8 +49,10 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
whoIsTypingString: function(whoIsTyping, limit) {
|
whoIsTypingString: function(whoIsTyping, limit) {
|
||||||
const othersCount = limit === undefined ?
|
let othersCount = 0;
|
||||||
0 : Math.max(whoIsTyping.length - limit, 0);
|
if (whoIsTyping.length > limit) {
|
||||||
|
othersCount = whoIsTyping.length - limit + 1;
|
||||||
|
}
|
||||||
if (whoIsTyping.length == 0) {
|
if (whoIsTyping.length == 0) {
|
||||||
return '';
|
return '';
|
||||||
} else if (whoIsTyping.length == 1) {
|
} else if (whoIsTyping.length == 1) {
|
||||||
|
@ -61,7 +63,7 @@ module.exports = {
|
||||||
});
|
});
|
||||||
if (othersCount) {
|
if (othersCount) {
|
||||||
const other = ' other' + (othersCount > 1 ? 's' : '');
|
const other = ' other' + (othersCount > 1 ? 's' : '');
|
||||||
return names.slice(0, limit).join(', ') + ' and ' +
|
return names.slice(0, limit - 1).join(', ') + ' and ' +
|
||||||
othersCount + other + ' are typing';
|
othersCount + other + ' are typing';
|
||||||
} else {
|
} else {
|
||||||
const lastPerson = names.pop();
|
const lastPerson = names.pop();
|
||||||
|
|
|
@ -82,7 +82,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
whoIsTypingLimit: 2,
|
whoIsTypingLimit: 3,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -217,8 +217,11 @@ module.exports = React.createClass({
|
||||||
_renderTypingIndicatorAvatars: function(limit) {
|
_renderTypingIndicatorAvatars: function(limit) {
|
||||||
let users = this.state.usersTyping;
|
let users = this.state.usersTyping;
|
||||||
|
|
||||||
let othersCount = Math.max(users.length - limit, 0);
|
let othersCount = 0;
|
||||||
users = users.slice(0, limit);
|
if (users.length > limit) {
|
||||||
|
othersCount = users.length - limit + 1;
|
||||||
|
users = users.slice(0, limit - 1);
|
||||||
|
}
|
||||||
|
|
||||||
let avatars = users.map((u, index) => {
|
let avatars = users.map((u, index) => {
|
||||||
let showInitial = othersCount === 0 && index === users.length - 1;
|
let showInitial = othersCount === 0 && index === users.length - 1;
|
||||||
|
|
|
@ -1537,7 +1537,7 @@ module.exports = React.createClass({
|
||||||
onResize={this.onChildResize}
|
onResize={this.onChildResize}
|
||||||
onVisible={this.onStatusBarVisible}
|
onVisible={this.onStatusBarVisible}
|
||||||
onHidden={this.onStatusBarHidden}
|
onHidden={this.onStatusBarHidden}
|
||||||
whoIsTypingLimit={2}
|
whoIsTypingLimit={3}
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue