mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-02 05:32:18 +00:00
(js) Allow to fetch unseen count of all mailboxes
Fixes #522, #2776, #4276
This commit is contained in:
@@ -267,19 +267,31 @@
|
||||
}; // delegate
|
||||
|
||||
this.refreshUnseenCount = function() {
|
||||
var unseenCountFolders = $window.unseenCountFolders, refreshViewCheck;
|
||||
var unseenCountFolders, refreshViewCheck;
|
||||
|
||||
if (Preferences.defaults.SOGoMailFetchAllUnseenCountFolders === 1)
|
||||
unseenCountFolders = [];
|
||||
else
|
||||
unseenCountFolders = $window.unseenCountFolders;
|
||||
|
||||
_.forEach(vm.accounts, function(account) {
|
||||
|
||||
// Always include the INBOX
|
||||
if (!_.includes(unseenCountFolders, account.id + '/folderINBOX'))
|
||||
unseenCountFolders.push(account.id + '/folderINBOX');
|
||||
|
||||
_.forEach(account.$$flattenMailboxes, function(mailbox) {
|
||||
if (angular.isDefined(mailbox.unseenCount) &&
|
||||
!_.includes(unseenCountFolders, mailbox.id))
|
||||
if (Preferences.defaults.SOGoMailFetchAllUnseenCountFolders === 1) {
|
||||
// Include all mailboxes
|
||||
_.forEach(account.$$flattenMailboxes, function(mailbox) {
|
||||
unseenCountFolders.push(mailbox.id);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Always include the INBOX
|
||||
if (!_.includes(unseenCountFolders, account.id + '/folderINBOX'))
|
||||
unseenCountFolders.push(account.id + '/folderINBOX');
|
||||
|
||||
_.forEach(account.$$flattenMailboxes, function(mailbox) {
|
||||
if (angular.isDefined(mailbox.unseenCount) &&
|
||||
!_.includes(unseenCountFolders, mailbox.id))
|
||||
unseenCountFolders.push(mailbox.id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Account.$$resource.post('', 'unseenCount', {mailboxes: unseenCountFolders}).then(function(data) {
|
||||
|
||||
Reference in New Issue
Block a user