mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Added counters of unread messages for additional accounts (#377)
This commit is contained in:
parent
abddb3d828
commit
79233ad83c
19 changed files with 333 additions and 93 deletions
|
|
@ -15,28 +15,43 @@
|
|||
*/
|
||||
function AccountUserStore()
|
||||
{
|
||||
this.loading = ko.observable(false).extend({'throttle': 100});
|
||||
this.accounts = ko.observableArray([]);
|
||||
this.accounts.loading = ko.observable(false).extend({'throttle': 100});
|
||||
|
||||
this.collection = ko.observableArray([]);
|
||||
this.collectionEmailNames = ko.observableArray([]).extend({'throttle': 1000});
|
||||
this.collectionEmailNames.skipFirst = true;
|
||||
this.accountsEmailNames = ko.observableArray([]).extend({'throttle': 1000});
|
||||
this.accountsEmailNames.skipFirst = true;
|
||||
|
||||
this.collection.subscribe(function (aList) {
|
||||
this.collectionEmailNames(_.compact(_.map(aList, function (oItem) {
|
||||
this.accounts.subscribe(function (aList) {
|
||||
this.accountsEmailNames(_.compact(_.map(aList, function (oItem) {
|
||||
return oItem ? oItem.email : null;
|
||||
})));
|
||||
}, this);
|
||||
|
||||
this.collectionEmailNames.subscribe(function (aList) {
|
||||
if (this.collectionEmailNames.skipFirst)
|
||||
this.accountsEmailNames.subscribe(function (aList) {
|
||||
if (this.accountsEmailNames.skipFirst)
|
||||
{
|
||||
this.collectionEmailNames.skipFirst = false;
|
||||
this.accountsEmailNames.skipFirst = false;
|
||||
}
|
||||
else if (aList && 1 < aList.length)
|
||||
{
|
||||
Remote.accountSortOrder(null, aList);
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.accountsUnreadCount = ko.computed(function () {
|
||||
|
||||
var iResult = 0;
|
||||
|
||||
_.each(this.accounts(), function (oItem) {
|
||||
if (oItem)
|
||||
{
|
||||
iResult += oItem.count();
|
||||
}
|
||||
});
|
||||
|
||||
return iResult;
|
||||
|
||||
}, this);
|
||||
}
|
||||
|
||||
module.exports = new AccountUserStore();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
return iResult;
|
||||
|
||||
}, this);
|
||||
}, this).extend({'notify': 'always'});
|
||||
|
||||
this.enableDesktopNotification = ko.computed({
|
||||
'owner': this,
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
this.allowDesktopNotification(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}).extend({'notify': 'always'});
|
||||
|
||||
if (!this.enableDesktopNotification.valueHasMutated)
|
||||
{
|
||||
|
|
@ -150,7 +150,8 @@
|
|||
this.soundNotificationIsSupported(true);
|
||||
|
||||
this.buzz = new buzz.sound(Links.sound('new-mail'), {
|
||||
formats: ['ogg', 'mp3']
|
||||
'preload': 'none',
|
||||
'formats': ['mp3', 'ogg']
|
||||
});
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue