implement function for account-wide unread mail count

This commit is contained in:
zefie
2022-02-20 11:18:42 -05:00
parent 0f26cdfc70
commit 701cd25b83
2 changed files with 18 additions and 0 deletions

View File

@@ -63,6 +63,23 @@ class WTVClientSessionData {
this.mailstore = new WTVMail(this.minisrv_config, this)
}
getAccountTotalUnreadMessages() {
if (!this.isRegistered()) return false; // unregistered
if (this.user_id > 0) return false; // not primary user or pre-login
var total_unread_messages = 0;
for (var i = 0; i < this.minisrv_config.config.user_accounts.max_users_per_account; i++) {
var subUserSession = new this.constructor(this.minisrv_config, this.ssid);
subUserSession.switchUserID(i, false, false);
subUserSession.assignMailStore();
if (subUserSession.mailstore) {
total_unread_messages += subUserSession.mailstore.countUnreadMessages(0);
}
}
return total_unread_messages;
}
switchUserID(user_id, update_mail = true, update_ticket = true) {
this.user_id = user_id;
this.loadSessionData();

View File

@@ -38,6 +38,7 @@ class WTVShared {
}
}
htmlEntitize(string, process_newline = false) {
string = this.html_entities.encode(string).replace(/&apos;/g, "'");