From d67d76bf3a3b2ec4547477baf7665f552c1e99ef Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 28 Aug 2020 10:45:03 -0500 Subject: [PATCH] Chats: only mark read on hover when the chat is open --- app/soapbox/features/chats/components/chat_window.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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)}