mirror of https://github.com/vector-im/riot-web
add comments
parent
1db6f1b652
commit
146e651dae
|
@ -45,6 +45,11 @@ module.exports = React.createClass({
|
||||||
return {
|
return {
|
||||||
usersTyping: WhoIsTyping.usersTypingApartFromMe(this.props.room),
|
usersTyping: WhoIsTyping.usersTypingApartFromMe(this.props.room),
|
||||||
userTimers: {},
|
userTimers: {},
|
||||||
|
// a map with userid => Timer to delay
|
||||||
|
// hiding the "x is typing" message for a
|
||||||
|
// user so hiding it can coincide
|
||||||
|
// with the sent message by the other side
|
||||||
|
// resulting in less timeline jumpiness
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -78,6 +83,7 @@ module.exports = React.createClass({
|
||||||
// remove user from usersTyping
|
// remove user from usersTyping
|
||||||
const usersTyping = this.state.usersTyping.filter((m) => m.userId !== userId);
|
const usersTyping = this.state.usersTyping.filter((m) => m.userId !== userId);
|
||||||
this.setState({usersTyping});
|
this.setState({usersTyping});
|
||||||
|
// abort timer if any
|
||||||
this._abortUserTimer(userId);
|
this._abortUserTimer(userId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -177,6 +183,9 @@ module.exports = React.createClass({
|
||||||
let usersTyping = this.state.usersTyping;
|
let usersTyping = this.state.usersTyping;
|
||||||
const stoppedUsersOnTimer = Object.keys(this.state.userTimers)
|
const stoppedUsersOnTimer = Object.keys(this.state.userTimers)
|
||||||
.map((userId) => this.props.room.getMember(userId));
|
.map((userId) => this.props.room.getMember(userId));
|
||||||
|
// append the users that have been reported not typing anymore
|
||||||
|
// but have a timeout timer running so they can disappear
|
||||||
|
// when a message comes in
|
||||||
usersTyping = usersTyping.concat(stoppedUsersOnTimer);
|
usersTyping = usersTyping.concat(stoppedUsersOnTimer);
|
||||||
|
|
||||||
const typingString = WhoIsTyping.whoIsTypingString(
|
const typingString = WhoIsTyping.whoIsTypingString(
|
||||||
|
|
Loading…
Reference in New Issue