mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Bugfix boostrap alerts.less was accidentally removed
Bugfix Date.fromNow('past'/'future') reversed
Replace Events[pub/sub]('interval.*') with setInterval()
Events[pub/sub] to native
Cleanup knockout extensions
Replaced momentToNode with proper HTML5 <time>
Cleanup Momentor
This commit is contained in:
parent
6541a1de7c
commit
9f1ea1a0fd
44 changed files with 539 additions and 1126 deletions
|
|
@ -7,8 +7,6 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|||
import { folderListOptionsBuilder } from 'Common/Utils';
|
||||
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||
|
||||
import { momentNowUnix } from 'Common/Momentor';
|
||||
|
||||
class FolderUserStore {
|
||||
constructor() {
|
||||
this.displaySpecSetting = ko.observable(true);
|
||||
|
|
@ -157,7 +155,7 @@ class FolderUserStore {
|
|||
getNextFolderNames() {
|
||||
const result = [],
|
||||
limit = 5,
|
||||
utc = momentNowUnix(),
|
||||
utc = Date.now() / 1000,
|
||||
timeout = utc - 60 * 5,
|
||||
timeouts = [],
|
||||
inboxFolderName = getFolderInboxName(),
|
||||
|
|
@ -182,15 +180,7 @@ class FolderUserStore {
|
|||
|
||||
fSearchFunction(this.folderList());
|
||||
|
||||
timeouts.sort((a, b) => {
|
||||
if (a[0] < b[0]) {
|
||||
return -1;
|
||||
} else if (a[0] > b[0]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
timeouts.sort((a, b) => (a[0] < b[0]) ? -1 : (a[0] > b[0] ? 1 : 0));
|
||||
|
||||
timeouts.find(aItem => {
|
||||
const folder = getFolderFromCacheList(aItem[1]);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts';
|
|||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import { mailBox, notificationMailIcon } from 'Common/Links';
|
||||
import { i18n, getNotification } from 'Common/Translator';
|
||||
import { momentNowUnix } from 'Common/Momentor';
|
||||
|
||||
import * as MessageHelper from 'Helper/Message';
|
||||
import { MessageModel } from 'Model/Message';
|
||||
|
|
@ -209,7 +208,7 @@ class MessageUserStore {
|
|||
this.messageList.subscribe(
|
||||
(list)=>{
|
||||
// debounce
|
||||
d && clearTimeout(d);
|
||||
clearTimeout(d);
|
||||
d = setTimeout(()=>list.forEach(item => {
|
||||
if (item && item.newForAnimation()) {
|
||||
item.newForAnimation(false);
|
||||
|
|
@ -750,7 +749,7 @@ class MessageUserStore {
|
|||
const folder = getFolderFromCacheList(isNormal(data.Result.Folder) ? data.Result.Folder : '');
|
||||
|
||||
if (folder && !cached) {
|
||||
folder.interval = momentNowUnix();
|
||||
folder.interval = Date.now() / 1000;
|
||||
|
||||
setFolderHash(data.Result.Folder, data.Result.FolderHash);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { DesktopNotification } from 'Common/Enums';
|
||||
import * as Events from 'Common/Events';
|
||||
import Audio from 'Common/Audio';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
|
@ -118,7 +117,7 @@ class NotificationUserStore {
|
|||
}
|
||||
}
|
||||
|
||||
displayDesktopNotification(imageSrc, title, text, nessageData) {
|
||||
displayDesktopNotification(imageSrc, title, text, messageData) {
|
||||
if (this.enableDesktopNotification()) {
|
||||
const NotificationClass = this.notificationClass(),
|
||||
notification = NotificationClass
|
||||
|
|
@ -133,12 +132,12 @@ class NotificationUserStore {
|
|||
notification.show();
|
||||
}
|
||||
|
||||
if (nessageData) {
|
||||
if (messageData) {
|
||||
notification.onclick = () => {
|
||||
focus();
|
||||
|
||||
if (nessageData.Folder && nessageData.Uid) {
|
||||
Events.pub('mailbox.message.show', [nessageData.Folder, nessageData.Uid]);
|
||||
if (messageData.Folder && messageData.Uid) {
|
||||
dispatchEvent(new CustomEvent('mailbox.message.show', {detail:messageData}));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
|||
import { Layout, EditorDefaultType } from 'Common/Enums';
|
||||
import { $htmlCL } from 'Common/Globals';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import * as Events from 'Common/Events';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
|
|
@ -48,7 +47,7 @@ class SettingsUserStore {
|
|||
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
|
||||
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
|
||||
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
|
||||
Events.pub('layout', [value]);
|
||||
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -65,16 +64,16 @@ class SettingsUserStore {
|
|||
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||
|
||||
Events.sub('rl.auto-logout-refresh', () => {
|
||||
const refresh = () => {
|
||||
clearTimeout(this.iAutoLogoutTimer);
|
||||
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
|
||||
this.iAutoLogoutTimer = setTimeout(() => {
|
||||
Events.pub('rl.auto-logout');
|
||||
}, this.autoLogout() * 60000);
|
||||
this.iAutoLogoutTimer = setTimeout(() =>
|
||||
dispatchEvent(new CustomEvent('rl.auto-logout'))
|
||||
, this.autoLogout() * 60000);
|
||||
}
|
||||
});
|
||||
|
||||
Events.pub('rl.auto-logout-refresh');
|
||||
};
|
||||
addEventListener('rl.auto-logout-refresh', refresh);
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue