diff --git a/app/soapbox/features/chats/components/chat_window.js b/app/soapbox/features/chats/components/chat_window.js index e1c67a2b2..056a33aa0 100644 --- a/app/soapbox/features/chats/components/chat_window.js +++ b/app/soapbox/features/chats/components/chat_window.js @@ -72,7 +72,11 @@ class ChatWindow extends ImmutablePureComponent { this.setState({ content: e.target.value }); } - handleReadChat = (e) => { + handleHover = () => { + if (this.props.pane.get('state') === 'open') this.markRead(); + } + + markRead = () => { const { dispatch, chat } = this.props; dispatch(markChatRead(chat.get('id'))); } @@ -108,7 +112,7 @@ class ChatWindow extends ImmutablePureComponent { ]; if (markReadConditions.every(c => c() === true)) - this.handleReadChat(); + this.markRead(); } render() { @@ -120,7 +124,7 @@ class ChatWindow extends ImmutablePureComponent { const unreadCount = chat.get('unread'); return ( -
+
{unreadCount > 0 ? {shortNumberFormat(unreadCount)}