mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
New thread list logic (step 1)
This commit is contained in:
parent
c73eb76816
commit
b656b6365b
10 changed files with 186 additions and 78 deletions
|
|
@ -214,12 +214,13 @@
|
|||
);
|
||||
}
|
||||
|
||||
}, FolderStore.currentFolderFullNameRaw(), iOffset, SettingsStore.messagesPerPage(), MessageStore.messageListSearch());
|
||||
}, FolderStore.currentFolderFullNameRaw(), iOffset, SettingsStore.messagesPerPage(),
|
||||
MessageStore.messageListSearch(), MessageStore.messageListThreadUid());
|
||||
};
|
||||
|
||||
AppUser.prototype.recacheInboxMessageList = function ()
|
||||
{
|
||||
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, SettingsStore.messagesPerPage(), '', true);
|
||||
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, SettingsStore.messagesPerPage(), '', '', true);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -257,23 +257,30 @@
|
|||
* @param {string} sFolder
|
||||
* @param {number=} iPage = 1
|
||||
* @param {string=} sSearch = ''
|
||||
* @param {string=} sThreadUid = ''
|
||||
* @return {string}
|
||||
*/
|
||||
Links.prototype.mailBox = function (sFolder, iPage, sSearch)
|
||||
Links.prototype.mailBox = function (sFolder, iPage, sSearch, sThreadUid)
|
||||
{
|
||||
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
|
||||
sSearch = Utils.pString(sSearch);
|
||||
|
||||
var sResult = this.sBase + 'mailbox/';
|
||||
var
|
||||
sResult = this.sBase + 'mailbox/',
|
||||
iThreadUid = Utils.pInt(sThreadUid)
|
||||
;
|
||||
|
||||
if ('' !== sFolder)
|
||||
{
|
||||
sResult += encodeURI(sFolder);
|
||||
sResult += encodeURI(sFolder) + (0 < iThreadUid ? '|' + iThreadUid : '');
|
||||
}
|
||||
|
||||
if (1 < iPage)
|
||||
{
|
||||
sResult = sResult.replace(/[\/]+$/, '');
|
||||
sResult += '/p' + iPage;
|
||||
}
|
||||
|
||||
if ('' !== sSearch)
|
||||
{
|
||||
sResult = sResult.replace(/[\/]+$/, '');
|
||||
|
|
|
|||
|
|
@ -332,10 +332,10 @@
|
|||
* @param {number=} iOffset = 0
|
||||
* @param {number=} iLimit = 20
|
||||
* @param {string=} sSearch = ''
|
||||
* @param {boolean=} bSilent = false
|
||||
* @param {string=} sThreadUid = ''
|
||||
* @param {boolean=} bSilent = false
|
||||
*/
|
||||
RemoteUserAjax.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent, sThreadUid)
|
||||
RemoteUserAjax.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, sThreadUid, bSilent)
|
||||
{
|
||||
sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,15 +75,23 @@
|
|||
MailBoxUserScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch)
|
||||
{
|
||||
var
|
||||
sFolderFullNameRaw = Cache.getFolderFullNameRaw(sFolderHash),
|
||||
oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw)
|
||||
sThreadUid = sFolderHash.replace(/^(.+)\|([\d]+)$/, '$2'),
|
||||
oFolder = Cache.getFolderFromCacheList(Cache.getFolderFullNameRaw(
|
||||
sFolderHash.replace(/\|([\d]+)$/, '')))
|
||||
;
|
||||
|
||||
if (oFolder)
|
||||
{
|
||||
if (sFolderHash === sThreadUid)
|
||||
{
|
||||
sThreadUid = '';
|
||||
}
|
||||
|
||||
FolderStore.currentFolder(oFolder);
|
||||
|
||||
MessageStore.messageListPage(iPage);
|
||||
MessageStore.messageListSearch(sSearch);
|
||||
MessageStore.messageListThreadUid(sThreadUid);
|
||||
|
||||
require('App/User').reloadMessageList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
this.messageListCount = ko.observable(0);
|
||||
this.messageListSearch = ko.observable('');
|
||||
this.messageListThreadUid = ko.observable('');
|
||||
this.messageListPage = ko.observable(1);
|
||||
this.messageListError = ko.observable('');
|
||||
|
||||
|
|
@ -813,6 +814,7 @@
|
|||
this.messageListCount(iCount);
|
||||
this.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
this.messageListPage(window.Math.ceil((iOffset / SettingsStore.messagesPerPage()) + 1));
|
||||
this.messageListThreadUid(Utils.isNormal(oData.Result.ThreadUid) ? Utils.pString(oData.Result.ThreadUid) : '');
|
||||
|
||||
this.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
|
||||
this.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
this.selectorMessageFocused = MessageStore.selectorMessageFocused;
|
||||
this.isMessageSelected = MessageStore.isMessageSelected;
|
||||
this.messageListSearch = MessageStore.messageListSearch;
|
||||
this.messageListThreadUid = MessageStore.messageListThreadUid;
|
||||
this.messageListError = MessageStore.messageListError;
|
||||
this.folderMenuForMove = FolderStore.folderMenuForMove;
|
||||
|
||||
|
|
@ -611,7 +612,8 @@
|
|||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
oPage.value,
|
||||
MessageStore.messageListSearch()
|
||||
MessageStore.messageListSearch(),
|
||||
MessageStore.messageListThreadUid()
|
||||
));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue