Determine the number of unread messages in all folders.

This commit is contained in:
RainLoop Team 2013-12-15 21:16:25 +04:00
parent 975947a948
commit b7c4aad3db
16 changed files with 499 additions and 262 deletions

View file

@ -199,64 +199,6 @@ EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtm
return sResult;
};
/**
* @return {string}
*/
EmailModel.prototype.select2Result = function ()
{
var
sResult = '',
sImg = RL.cache().getUserPic(this.email)
;
if ('' !== sImg)
{
sResult += '<img class="select2-user-pic pull-left" src="' + Utils.encodeHtml(sImg) + '" />';
}
else
{
sResult += '<img class="select2-user-pic pull-left" src="' + RL.link().emptyContactPic() + '" />';
}
if (Enums.EmailType.Facebook === this.type())
{
sResult += '' + (0 < this.name.length ? this.name : this.email);
sResult += '<i class="icon-facebook pull-right select2-icon-result" />';
}
else
{
sResult += '' + (0 < this.name.length ? this.email + ' <span class="select2-subname">(' + this.name + ')</span>' : this.email);
}
return sResult + '';
};
/**
* @param {Object} oContainer
* @return {string|null}
*/
EmailModel.prototype.select2Selection = function (oContainer)
{
var sResult = '';
if (Enums.EmailType.Facebook === this.type())
{
sResult = 0 < this.name.length ? this.name : this.email;
if ('' !== sResult)
{
$('<pan>').text(sResult).appendTo(oContainer);
oContainer.append('<i class="icon-facebook select2-icon"></i>');
return null;
}
}
else
{
sResult = 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
}
return sResult;
};
/**
* @param {string} $sEmailAddress
* @return {boolean}

View file

@ -20,6 +20,8 @@ function FolderModel()
this.isGmailFolder = false;
this.isUnpaddigFolder = false;
this.interval = 0;
this.type = ko.observable(Enums.FolderType.User);
this.selected = ko.observable(false);
@ -143,10 +145,21 @@ FolderModel.prototype.initComputed = function ()
RL.data().foldersInboxUnreadCount(iUnread);
}
// return 0 < iUnread ? '' + iUnread : '';
// return 0 < iUnread && 'INBOX' === this.fullNameRaw ? '' + iUnread : '';
return 0 < iUnread && (Enums.FolderType.Inbox === iType || Enums.FolderType.Spam === iType) ? '' + iUnread :
(0 < iCount && Enums.FolderType.Draft === iType ? '' + iCount : '');
if (0 < iCount)
{
if (Enums.FolderType.Draft === iType)
{
return '' + iCount;
}
else if (0 < iUnread && Enums.FolderType.Trash !== iType && Enums.FolderType.SentItems !== iType)
{
return '' + iUnread;
}
}
return '';
// return 0 < iUnread && (Enums.FolderType.Inbox === iType || Enums.FolderType.Spam === iType) ? '' + iUnread :
// (0 < iCount && Enums.FolderType.Draft === iType ? '' + iCount : '');
}, this);
this.canBeDeleted = ko.computed(function () {
@ -261,6 +274,7 @@ FolderModel.prototype.fullNameHash = '';
FolderModel.prototype.delimiter = '';
FolderModel.prototype.namespace = '';
FolderModel.prototype.deep = 0;
FolderModel.prototype.interval = 0;
FolderModel.prototype.isNamespaceFolder = false;
FolderModel.prototype.isGmailFolder = false;