Chats: mark as read when the input is focused

loading-indicator-on-tls^2
Alex Gleason 2020-08-27 18:06:25 -05:00
rodzic a349bce10f
commit 3fbdce6901
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -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() {