diff --git a/app/soapbox/features/chats/components/chat_window.js b/app/soapbox/features/chats/components/chat_window.js index fed5cb525..af9f9bcee 100644 --- a/app/soapbox/features/chats/components/chat_window.js +++ b/app/soapbox/features/chats/components/chat_window.js @@ -99,6 +99,15 @@ class ChatWindow extends ImmutablePureComponent { if (oldState !== newState && newState === 'open') this.focusInput(); + + const markReadConditions = [ + () => this.props.chat !== undefined, + () => document.activeElement === this.inputElem, + () => this.props.chat.get('unread') > 0, + ]; + + if (markReadConditions.every(c => c() === true)) + this.handleReadChat(); } render() {