Fix linting warnings

This commit is contained in:
Luke Barnard 2017-01-24 17:18:56 +00:00
parent 4186a769ca
commit a92fff9da7
2 changed files with 12 additions and 4 deletions

View file

@ -34,7 +34,8 @@ module.exports = {
whoIsTypingString: function(room, limit) { whoIsTypingString: function(room, limit) {
const whoIsTyping = this.usersTypingApartFromMe(room); const whoIsTyping = this.usersTypingApartFromMe(room);
const othersCount = limit === undefined ? 0 : Math.max(whoIsTyping.length - limit, 0); const othersCount = limit === undefined ?
0 : Math.max(whoIsTyping.length - limit, 0);
if (whoIsTyping.length == 0) { if (whoIsTyping.length == 0) {
return ''; return '';
} else if (whoIsTyping.length == 1) { } else if (whoIsTyping.length == 1) {
@ -45,7 +46,8 @@ 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 ' + othersCount + other + ' are typing'; return names.slice(0, limit).join(', ') + ' and ' +
othersCount + other + ' are typing';
} else { } else {
const lastPerson = names.pop(); const lastPerson = names.pop();
return names.join(', ') + ' and ' + lastPerson + ' are typing'; return names.join(', ') + ' and ' + lastPerson + ' are typing';

View file

@ -88,7 +88,10 @@ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
syncState: MatrixClientPeg.get().getSyncState(), syncState: MatrixClientPeg.get().getSyncState(),
whoisTypingString: WhoIsTyping.whoIsTypingString(this.props.room, this.props.whoIsTypingLimit), whoisTypingString: WhoIsTyping.whoIsTypingString(
this.props.room,
this.props.whoIsTypingLimit
),
}; };
}, },
@ -135,7 +138,10 @@ module.exports = React.createClass({
onRoomMemberTyping: function(ev, member) { onRoomMemberTyping: function(ev, member) {
this.setState({ this.setState({
whoisTypingString: WhoIsTyping.whoIsTypingString(this.props.room, this.props.whoIsTypingLimit), whoisTypingString: WhoIsTyping.whoIsTypingString(
this.props.room,
this.props.whoIsTypingLimit
),
}); });
}, },