Chats: only mark read on hover when the chat is open
This commit is contained in:
parent
942b3fdebe
commit
d67d76bf3a
1 changed files with 7 additions and 3 deletions
|
@ -72,7 +72,11 @@ class ChatWindow extends ImmutablePureComponent {
|
||||||
this.setState({ content: e.target.value });
|
this.setState({ content: e.target.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleReadChat = (e) => {
|
handleHover = () => {
|
||||||
|
if (this.props.pane.get('state') === 'open') this.markRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
markRead = () => {
|
||||||
const { dispatch, chat } = this.props;
|
const { dispatch, chat } = this.props;
|
||||||
dispatch(markChatRead(chat.get('id')));
|
dispatch(markChatRead(chat.get('id')));
|
||||||
}
|
}
|
||||||
|
@ -108,7 +112,7 @@ class ChatWindow extends ImmutablePureComponent {
|
||||||
];
|
];
|
||||||
|
|
||||||
if (markReadConditions.every(c => c() === true))
|
if (markReadConditions.every(c => c() === true))
|
||||||
this.handleReadChat();
|
this.markRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -120,7 +124,7 @@ class ChatWindow extends ImmutablePureComponent {
|
||||||
const unreadCount = chat.get('unread');
|
const unreadCount = chat.get('unread');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }} onMouseOver={this.handleReadChat}>
|
<div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }} onMouseOver={this.handleHover}>
|
||||||
<div className='pane__header'>
|
<div className='pane__header'>
|
||||||
{unreadCount > 0
|
{unreadCount > 0
|
||||||
? <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>
|
? <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>
|
||||||
|
|
Loading…
Reference in a new issue