kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Chats: mark as read when the input is focused
rodzic
a349bce10f
commit
3fbdce6901
|
@ -99,6 +99,15 @@ class ChatWindow extends ImmutablePureComponent {
|
||||||
|
|
||||||
if (oldState !== newState && newState === 'open')
|
if (oldState !== newState && newState === 'open')
|
||||||
this.focusInput();
|
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() {
|
render() {
|
||||||
|
|
Ładowanie…
Reference in New Issue