mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 09:02:45 +08:00
I broke Remote.messageList() in previous commit
This commit is contained in:
parent
be512a0333
commit
d3b716cfda
2 changed files with 43 additions and 45 deletions
|
@ -14,11 +14,6 @@ import { serverRequest } from 'Common/Links';
|
|||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
import { b64EncodeJSONSafe } from 'Common/Utils';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { SUB_QUERY_PREFIX } from 'Common/Links';
|
||||
import { AppUserStore } from 'Stores/User/App';
|
||||
|
||||
export const
|
||||
|
||||
sortFolders = folders => {
|
||||
|
@ -32,44 +27,6 @@ sortFolders = folders => {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {object} params
|
||||
*/
|
||||
messageList = params => {
|
||||
const
|
||||
// folder = getFolderFromCacheList(params.folder.fullName),
|
||||
folder = getFolderFromCacheList(params.folder),
|
||||
folderHash = folder?.hash || '';
|
||||
|
||||
params = Object.assign({
|
||||
offset: 0,
|
||||
limit: SettingsUserStore.messagesPerPage(),
|
||||
search: '',
|
||||
uidNext: folder?.uidNext || 0, // Used to check for new messages
|
||||
sort: FolderUserStore.sortMode()
|
||||
}, params);
|
||||
if (AppUserStore.threadsAllowed() && SettingsUserStore.useThreads()) {
|
||||
params.useThreads = 1;
|
||||
} else {
|
||||
params.threadUid = 0;
|
||||
}
|
||||
|
||||
let sGetAdd = '';
|
||||
if (folderHash) {
|
||||
params.hash = folderHash + '-' + SettingsGet('AccountHash');
|
||||
sGetAdd = 'MessageList/' + SUB_QUERY_PREFIX + '/' + b64EncodeJSONSafe(params);
|
||||
params = {};
|
||||
}
|
||||
|
||||
Remote.abort('MessageList');
|
||||
Remote.request('MessageList',
|
||||
null,
|
||||
params,
|
||||
60000, // 60 seconds before aborting
|
||||
sGetAdd
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Array=} aDisabled
|
||||
* @param {Array=} aHeaderLines
|
||||
|
@ -185,8 +142,8 @@ folderInformation = (folder, list) => {
|
|||
if (folderFromCache.fullName === FolderUserStore.currentFolderFullName()) {
|
||||
MessagelistUserStore.reload();
|
||||
} else if (getFolderInboxName() === folderFromCache.fullName) {
|
||||
// messageList({folder: getFolderFromCacheList(getFolderInboxName())});
|
||||
messageList({folder: getFolderInboxName()});
|
||||
// Remote.messageList(null, {folder: getFolderFromCacheList(getFolderInboxName())}, true);
|
||||
Remote.messageList(null, {folder: getFolderInboxName()}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,52 @@ import { SUB_QUERY_PREFIX } from 'Common/Links';
|
|||
|
||||
import { AppUserStore } from 'Stores/User/App';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
|
||||
import { AbstractFetchRemote } from 'Remote/AbstractFetch';
|
||||
|
||||
class RemoteUserFetch extends AbstractFetchRemote {
|
||||
|
||||
/**
|
||||
* @param {Function} fCallback
|
||||
* @param {object} params
|
||||
* @param {boolean=} bSilent = false
|
||||
*/
|
||||
messageList(fCallback, params, bSilent = false) {
|
||||
const
|
||||
// folder = getFolderFromCacheList(params.folder.fullName),
|
||||
folder = getFolderFromCacheList(params.folder),
|
||||
folderHash = folder?.hash || '';
|
||||
|
||||
params = Object.assign({
|
||||
offset: 0,
|
||||
limit: SettingsUserStore.messagesPerPage(),
|
||||
search: '',
|
||||
uidNext: folder?.uidNext || 0, // Used to check for new messages
|
||||
sort: FolderUserStore.sortMode()
|
||||
}, params);
|
||||
if (AppUserStore.threadsAllowed() && SettingsUserStore.useThreads()) {
|
||||
params.useThreads = 1;
|
||||
} else {
|
||||
params.threadUid = 0;
|
||||
}
|
||||
|
||||
let sGetAdd = '';
|
||||
if (folderHash) {
|
||||
params.hash = folderHash + '-' + SettingsGet('AccountHash');
|
||||
sGetAdd = 'MessageList/' + SUB_QUERY_PREFIX + '/' + b64EncodeJSONSafe(params);
|
||||
params = {};
|
||||
}
|
||||
|
||||
bSilent || this.abort('MessageList');
|
||||
this.request('MessageList',
|
||||
fCallback,
|
||||
params,
|
||||
60000, // 60 seconds before aborting
|
||||
sGetAdd
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sFolderFullName
|
||||
|
|
Loading…
Reference in a new issue