mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 04:22:15 +08:00
Remove MessageUserStore.listEnd* overhead
This commit is contained in:
parent
c7a0573852
commit
eb669715ca
3 changed files with 21 additions and 32 deletions
|
@ -82,10 +82,8 @@ export const MessageUserStore = new class {
|
|||
listPageBeforeThread: 1,
|
||||
listError: '',
|
||||
|
||||
listEndFolder: '',
|
||||
listEndSearch: '',
|
||||
listEndHash: '',
|
||||
listEndThreadUid: 0,
|
||||
listEndPage: 1,
|
||||
|
||||
listLoading: false,
|
||||
// Happens when message(s) removed from list
|
||||
|
@ -120,15 +118,6 @@ export const MessageUserStore = new class {
|
|||
return value;
|
||||
},
|
||||
*/
|
||||
listEndHash: () =>
|
||||
this.listEndFolder() +
|
||||
'|' +
|
||||
this.listEndSearch() +
|
||||
'|' +
|
||||
this.listEndThreadUid() +
|
||||
'|' +
|
||||
this.listEndPage(),
|
||||
|
||||
listPageCount: () => Math.max(1, Math.ceil(this.listCount() / SettingsUserStore.messagesPerPage())),
|
||||
|
||||
mainMessageListSearch: {
|
||||
|
@ -199,13 +188,6 @@ export const MessageUserStore = new class {
|
|||
}
|
||||
},
|
||||
|
||||
listEndFolder: folder => {
|
||||
const message = this.message();
|
||||
if (message && folder && folder !== message.folder) {
|
||||
this.message(null);
|
||||
}
|
||||
},
|
||||
|
||||
isMessageSelected: value => elementById('rl-right').classList.toggle('message-selected', value)
|
||||
});
|
||||
|
||||
|
@ -658,12 +640,19 @@ export const MessageUserStore = new class {
|
|||
this.listCount(collection.MessageResultCount);
|
||||
this.listSearch(pString(collection.Search));
|
||||
this.listPage(Math.ceil(collection.Offset / SettingsUserStore.messagesPerPage() + 1));
|
||||
this.listThreadUid(data.Result.ThreadUid);
|
||||
this.listThreadUid(collection.ThreadUid);
|
||||
|
||||
this.listEndFolder(collection.Folder);
|
||||
this.listEndSearch(this.listSearch());
|
||||
this.listEndThreadUid(this.listThreadUid());
|
||||
this.listEndPage(this.listPage());
|
||||
this.listEndHash(
|
||||
collection.Folder +
|
||||
'|' + collection.Search +
|
||||
'|' + this.listThreadUid() +
|
||||
'|' + this.listPage()
|
||||
);
|
||||
this.listEndThreadUid(collection.ThreadUid);
|
||||
const message = this.message();
|
||||
if (message && collection.Folder !== message.folder) {
|
||||
this.message(null);
|
||||
}
|
||||
|
||||
this.listDisableAutoSelect(true);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
|
||||
this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList;
|
||||
|
||||
this.messageListEndThreadUid = MessageUserStore.listEndThreadUid;
|
||||
this.messageListThreadUid = MessageUserStore.listEndThreadUid;
|
||||
|
||||
this.messageListIsLoading = MessageUserStore.listIsLoading;
|
||||
|
||||
|
@ -115,7 +115,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
),
|
||||
|
||||
messageListSearchDesc: () => {
|
||||
const value = MessageUserStore.listEndSearch();
|
||||
const value = MessageUserStore.list().Search;
|
||||
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { SEARCH: value }) : ''
|
||||
},
|
||||
|
||||
|
@ -142,17 +142,17 @@ export class MailMessageList extends AbstractViewRight {
|
|||
|
||||
hasMessages: () => 0 < MessageUserStore.list.length,
|
||||
|
||||
isSpamFolder: () => (FolderUserStore.spamFolder() || 0) === MessageUserStore.listEndFolder(),
|
||||
isSpamFolder: () => (FolderUserStore.spamFolder() || 0) === MessageUserStore.list().Folder,
|
||||
|
||||
isSpamDisabled: () => UNUSED_OPTION_VALUE === FolderUserStore.spamFolder(),
|
||||
|
||||
isTrashFolder: () => (FolderUserStore.trashFolder() || 0) === MessageUserStore.listEndFolder(),
|
||||
isTrashFolder: () => (FolderUserStore.trashFolder() || 0) === MessageUserStore.list().Folder,
|
||||
|
||||
isDraftFolder: () => (FolderUserStore.draftsFolder() || 0) === MessageUserStore.listEndFolder(),
|
||||
isDraftFolder: () => (FolderUserStore.draftsFolder() || 0) === MessageUserStore.list().Folder,
|
||||
|
||||
isSentFolder: () => (FolderUserStore.sentFolder() || 0) === MessageUserStore.listEndFolder(),
|
||||
isSentFolder: () => (FolderUserStore.sentFolder() || 0) === MessageUserStore.list().Folder,
|
||||
|
||||
isArchiveFolder: () => (FolderUserStore.archiveFolder() || 0) === MessageUserStore.listEndFolder(),
|
||||
isArchiveFolder: () => (FolderUserStore.archiveFolder() || 0) === MessageUserStore.list().Folder,
|
||||
|
||||
isArchiveDisabled: () => UNUSED_OPTION_VALUE === FolderUserStore.archiveFolder(),
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
<!-- /ko -->
|
||||
</div>
|
||||
<div class="b-content" data-bind="initDom: dragOverBodyArea">
|
||||
<div class="listThreadUidDesc" data-bind="visible: messageListEndThreadUid(), click: cancelThreadUid">
|
||||
<div class="listThreadUidDesc" data-bind="visible: messageListThreadUid(), click: cancelThreadUid">
|
||||
<i class="fontastic">⬅</i>
|
||||
<span data-i18n="MESSAGE_LIST/BACK_TO_MESSAGE_LIST"></span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue