mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-30 19:41:46 +08:00
Drop prefetch/REQUESTED_MESSAGE_CACHE because 99.9% not used.
Message cache needs new design due to encrypted messages.
This commit is contained in:
parent
a60d027169
commit
42fe9ae1ba
6 changed files with 2 additions and 53 deletions
|
@ -4,7 +4,6 @@ import { isArray } from 'Common/Utils';
|
|||
let FOLDERS_CACHE = {},
|
||||
FOLDERS_NAME_CACHE = {},
|
||||
MESSAGE_FLAGS_CACHE = {},
|
||||
REQUESTED_MESSAGE_CACHE = {},
|
||||
inboxFolderName = 'INBOX';
|
||||
|
||||
export const
|
||||
|
@ -15,7 +14,6 @@ export const
|
|||
FOLDERS_CACHE = {};
|
||||
FOLDERS_NAME_CACHE = {};
|
||||
MESSAGE_FLAGS_CACHE = {};
|
||||
REQUESTED_MESSAGE_CACHE = {};
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -25,19 +23,6 @@ export const
|
|||
*/
|
||||
getMessageKey = (folderFullName, uid) => folderFullName + '#' + uid,
|
||||
|
||||
/**
|
||||
* @param {string} folder
|
||||
* @param {string} uid
|
||||
*/
|
||||
addRequestedMessage = (folder, uid) => REQUESTED_MESSAGE_CACHE[getMessageKey(folder, uid)] = true,
|
||||
|
||||
/**
|
||||
* @param {string} folder
|
||||
* @param {string} uid
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasRequestedMessage = (folder, uid) => true === REQUESTED_MESSAGE_CACHE[getMessageKey(folder, uid)],
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { MessageFlagsCache, addRequestedMessage } from 'Common/Cache';
|
||||
import { MessageFlagsCache } from 'Common/Cache';
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { MessageSetAction, ComposeType/*, FolderType*/ } from 'Common/EnumsUser';
|
||||
import { doc, createElement, elementById, dropdowns, dropdownVisibility } from 'Common/Globals';
|
||||
|
@ -290,7 +290,6 @@ populateMessageBody = (oMessage, preload) => {
|
|||
}
|
||||
*/
|
||||
isNew || message.revivePropertiesFromJson(json);
|
||||
addRequestedMessage(message.folder, message.uid);
|
||||
if (messagesDom) {
|
||||
let id = 'rl-msg-' + message.hash.replace(/[^a-zA-Z0-9]/g, ''),
|
||||
body = elementById(id);
|
||||
|
|
|
@ -24,9 +24,7 @@ import { i18n, initOnStartOrLangChange } from 'Common/Translator';
|
|||
|
||||
import {
|
||||
getFolderFromCacheList,
|
||||
MessageFlagsCache,
|
||||
hasRequestedMessage,
|
||||
addRequestedMessage
|
||||
MessageFlagsCache
|
||||
} from 'Common/Cache';
|
||||
|
||||
import { AppUserStore } from 'Stores/User/App';
|
||||
|
@ -61,7 +59,6 @@ export class MailMessageList extends AbstractViewRight {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.bPrefetch = false;
|
||||
this.emptySubjectValue = '';
|
||||
|
||||
this.iGoToUpOrDownTimeout = 0;
|
||||
|
@ -817,35 +814,6 @@ export class MailMessageList extends AbstractViewRight {
|
|||
addShortcut('arrowright', 'meta', Scope.MessageView, ()=>false);
|
||||
|
||||
addShortcut('f', 'meta', Scope.MessageList, ()=>this.advancedSearchClick());
|
||||
|
||||
if (!ThemeStore.isMobile() && SettingsCapa('Prefetch')) {
|
||||
ifvisible.idle(this.prefetchNextTick.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
prefetchNextTick() {
|
||||
if (!this.bPrefetch && !ifvisible.now() && !this.viewModelDom.hidden) {
|
||||
const message = MessagelistUserStore.find(
|
||||
item => item && !hasRequestedMessage(item.folder, item.uid)
|
||||
);
|
||||
if (message) {
|
||||
this.bPrefetch = true;
|
||||
|
||||
addRequestedMessage(message.folder, message.uid);
|
||||
|
||||
Remote.message(
|
||||
iError => {
|
||||
const next = !iError;
|
||||
setTimeout(() => {
|
||||
this.bPrefetch = false;
|
||||
next && this.prefetchNextTick();
|
||||
}, 1000);
|
||||
},
|
||||
message.folder,
|
||||
message.uid
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedSearchClick() {
|
||||
|
|
|
@ -1165,7 +1165,6 @@ class Actions
|
|||
'Kolab' => false, // See Kolab plugin
|
||||
'MessageActions' => (bool) $oConfig->Get('capa', 'message_actions', true),
|
||||
'OpenPGP' => (bool) $oConfig->Get('security', 'openpgp', false),
|
||||
'Prefetch' => (bool) $oConfig->Get('labs', 'allow_prefetch', false),
|
||||
'Quota' => (bool) $oConfig->Get('capa', 'quota', true),
|
||||
'Search' => (bool) $oConfig->Get('capa', 'search', true),
|
||||
'SearchAdv' => (bool) $oConfig->Get('capa', 'search', true) && $oConfig->Get('capa', 'search_adv', true),
|
||||
|
|
|
@ -337,7 +337,6 @@ Enables caching in the system'),
|
|||
),
|
||||
|
||||
'labs' => array(
|
||||
'allow_prefetch' => array(false),
|
||||
'cache_system_data' => array(true),
|
||||
'date_from_headers' => array(true),
|
||||
'autocreate_system_folders' => array(false),
|
||||
|
|
|
@ -6,7 +6,6 @@ class Capa
|
|||
{
|
||||
const GNUPG = 'GnuPG';
|
||||
const OPEN_PGP = 'OpenPGP';
|
||||
const PREFETCH = 'Prefetch';
|
||||
const THEMES = 'Themes';
|
||||
const USER_BACKGROUND = 'UserBackground';
|
||||
const SIEVE = 'Sieve';
|
||||
|
|
Loading…
Reference in a new issue