Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit

Permalink
Dont notify when marking something unread after #411
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas101 committed Oct 31, 2016
1 parent 3c4903f commit 1494cc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/scenes/mailboxes/src/Notifications/UnreadNotifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@ class UnreadNotifications {

store.allMailboxes().forEach((mailbox, k) => {
if (!mailbox.showNotifications) { return }

const lastHistoryId = mailbox.google.unnotifiedMessages.reduce((acc, message) => {
const lastInternalDate = mailbox.google.unnotifiedMessages.reduce((acc, message) => {
if (!firstRun) {
this.showNotification(mailbox, message)
}
if (acc === undefined) {
return parseInt(message.historyId)
return parseInt(message.internalDate)
} else {
return parseInt(message.historyId) > acc ? parseInt(message.historyId) : acc
return parseInt(message.internalDate) > acc ? parseInt(message.internalDate) : acc
}
}, undefined)

if (lastHistoryId !== undefined) {
flux.mailbox.A.setGoogleLastNotifiedHistoryId.defer(mailbox.id, lastHistoryId)
if (lastInternalDate !== undefined) {
flux.mailbox.A.setGoogleLastNotifiedInternalDate.defer(mailbox.id, lastInternalDate)
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/scenes/mailboxes/src/stores/mailbox/mailboxActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ class MailboxActions {
* @param id: the id of the mailbox
* @param historyId: the last historyId
*/
setGoogleLastNotifiedHistoryId (id, historyId) {
return this.update(id, 'googleUnreadMessageInfo_v2.lastNotifiedHistoryId', parseInt(historyId))
setGoogleLastNotifiedInternalDate (id, internalDate) {
return this.update(id, 'googleUnreadMessageInfo_v2.lastNotifiedInternalDate', parseInt(internalDate))
}

/* **************************************************************************/
Expand Down
6 changes: 3 additions & 3 deletions src/shared/Models/Mailbox/Google.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ class Google extends Model {
}
get unnotifiedMessages () {
return this.latestUnreadMessages.filter((message) => {
return parseInt(message.historyId) > this.lastNotifiedHistoryId
return parseInt(message.internalDate) > this.lastNotifiedInternalDate
})
}
get lastNotifiedHistoryId () {
return this.__data__.unreadMessages.lastNotifiedHistoryId || 0
get lastNotifiedInternalDate () {
return this.__data__.unreadMessages.lastNotifiedInternalDate || 0
}
}

Expand Down

0 comments on commit 1494cc8

Please sign in to comment.