New Idle timer; messages not marked read if user is idle

This commit is contained in:
Scott Nonnenberg 2019-09-19 15:16:46 -07:00
parent b77246a7e0
commit 8ccb89310b
11 changed files with 55 additions and 55 deletions

View file

@ -166,7 +166,7 @@
if (!$.contains(this.el, this.inboxView.el)) {
this.openView(this.inboxView);
}
window.focus(); // FIXME
return Promise.resolve();
},
onEmpty() {

View file

@ -442,7 +442,7 @@
id,
models.map(model => model.getReduxData()),
isNewMessage,
document.hasFocus()
window.isActive()
);
} catch (error) {
setMessagesLoading(conversationId, true);
@ -493,7 +493,7 @@
id,
models.map(model => model.getReduxData()),
isNewMessage,
document.hasFocus()
window.isActive()
);
} catch (error) {
setMessagesLoading(conversationId, false);
@ -502,10 +502,8 @@
finish();
}
};
const markMessageRead = async (messageId, forceFocus) => {
// We need a forceFocus parameter because the BrowserWindow focus event fires
// before the document realizes that it has focus.
if (!document.hasFocus() && !forceFocus) {
const markMessageRead = async messageId => {
if (!window.isActive()) {
return;
}