This commit is contained in:
the-djmaze 2022-12-07 17:36:04 +01:00
parent 9bb65609e2
commit 079f334bcc
4 changed files with 64 additions and 28 deletions

View file

@ -1,5 +1,6 @@
import { AbstractModel } from 'Knoin/AbstractModel';
import { addObservablesTo } from 'External/ko';
import Remote from 'Remote/User/Fetch';
export class AccountModel extends AbstractModel {
/**
@ -7,7 +8,7 @@ export class AccountModel extends AbstractModel {
* @param {boolean=} canBeDelete = true
* @param {number=} count = 0
*/
constructor(email, name/*, count = 0*/, isAdditional = true) {
constructor(email, name, isAdditional = true) {
super();
this.name = name;
@ -16,17 +17,31 @@ export class AccountModel extends AbstractModel {
this.displayName = name ? name + ' <' + email + '>' : email;
addObservablesTo(this, {
// count: count || 0,
unreadEmails: null,
askDelete: false,
isAdditional: isAdditional
});
// Load at random between 3 and 30 seconds
setTimeout(()=>this.fetchUnread(), (Math.ceil(Math.random() * 10)) * 3000);
}
/**
* Get INBOX unread messages
*/
fetchUnread() {
Remote.request('AccountUnread', (iError, oData) => {
iError || this.unreadEmails(oData?.Result?.unreadEmails || null);
}, {
email: this.email
});
}
/**
* Imports all mail to main account
*//*
importAll(account) {
rl.app.Remote.streamPerLine(line => {
Remote.streamPerLine(line => {
try {
line = JSON.parse(line);
console.dir(line);

View file

@ -69,13 +69,25 @@
white-space: nowrap;
}
.counter {
display: inline-block;
}
.dropdown-menu a.account-item {
padding-right: 5px;
}
span[data-unread]::after {
content: attr(data-unread);
background-color: var(--unread-count-bg-color, #999);
border-radius: 1em;
color: var(--unread-count-color, #fff);
font-size: 11px;
line-height: 1.5em;
min-width: 1.7em;
padding: 1px 4px;
text-align: center;
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
position: absolute;
right: 3px;
}
}
@keyframes equaliserBar {