mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 11:15:13 -05:00
Don't mark messages as read when window is not in focus
This commit is contained in:
parent
f79b6bfaa1
commit
9924f08794
1 changed files with 6 additions and 1 deletions
|
@ -734,7 +734,7 @@ export default class App extends Component {
|
|||
let prevReadReceipt = buf.prevReadReceipt;
|
||||
let receipts = { [ReceiptType.DELIVERED]: receiptFromMessage(msg) };
|
||||
|
||||
if (this.state.activeBuffer !== buf.id) {
|
||||
if (this.state.activeBuffer !== buf.id || !document.hasFocus()) {
|
||||
unread = Unread.union(unread, msgUnread);
|
||||
} else {
|
||||
receipts[ReceiptType.READ] = receiptFromMessage(msg);
|
||||
|
@ -1943,6 +1943,11 @@ export default class App extends Component {
|
|||
}
|
||||
|
||||
handleWindowFocus() {
|
||||
if (this.state.activeBuffer) {
|
||||
// TODO: only do this if scrolled at the bottom
|
||||
this.markBufferAsRead(this.state.activeBuffer);
|
||||
}
|
||||
|
||||
// When the user focuses gamja, send a PING to make sure we detect any
|
||||
// network errors ASAP
|
||||
|
||||
|
|
Loading…
Reference in a new issue