mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
New thread list logic (step 3)
This commit is contained in:
parent
03d26bc4c6
commit
8a4bce3591
7 changed files with 103 additions and 51 deletions
|
|
@ -174,7 +174,15 @@
|
|||
if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition)
|
||||
{
|
||||
MessageStore.messageListPage(1);
|
||||
MessageStore.messageListPageBeforeThread(1);
|
||||
iOffset = 0;
|
||||
|
||||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
MessageStore.messageListPage(),
|
||||
MessageStore.messageListSearch(),
|
||||
MessageStore.messageListThreadUid()
|
||||
), true, true);
|
||||
}
|
||||
|
||||
MessageStore.messageListLoading(true);
|
||||
|
|
@ -844,10 +852,8 @@
|
|||
AppUser.prototype.messageListAction = function (sFolderFullNameRaw, mUid, iSetAction, aMessages)
|
||||
{
|
||||
var
|
||||
bRoot = false,
|
||||
aAllUids = [],
|
||||
aRootUids = [],
|
||||
oFolder = null,
|
||||
aRootUids = [],
|
||||
iAlreadyUnread = 0
|
||||
;
|
||||
|
||||
|
|
@ -856,33 +862,16 @@
|
|||
aMessages = MessageStore.messageListChecked();
|
||||
}
|
||||
|
||||
if (true === mUid)
|
||||
{
|
||||
bRoot = true;
|
||||
}
|
||||
else if (aMessages && aMessages[0] && mUid &&
|
||||
sFolderFullNameRaw === aMessages[0].folderFullNameRaw && mUid === aMessages[0].uid)
|
||||
{
|
||||
bRoot = true;
|
||||
}
|
||||
aRootUids = _.uniq(_.compact(_.map(aMessages, function (oMessage) {
|
||||
return (oMessage && oMessage.uid) ? oMessage.uid : null;
|
||||
})));
|
||||
|
||||
_.each(aMessages, function (oMessage) {
|
||||
if (oMessage && oMessage.uid && oMessage.threads)
|
||||
{
|
||||
aRootUids.push(oMessage.uid);
|
||||
aAllUids = _.union(aAllUids, oMessage.threads(), [oMessage.uid]);
|
||||
}
|
||||
});
|
||||
|
||||
aAllUids = _.uniq(aAllUids);
|
||||
aRootUids = _.uniq(aRootUids);
|
||||
|
||||
if ('' !== sFolderFullNameRaw && 0 < aAllUids.length)
|
||||
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
|
||||
{
|
||||
switch (iSetAction) {
|
||||
case Enums.MessageSetAction.SetSeen:
|
||||
|
||||
_.each(bRoot ? aAllUids : aRootUids, function (sSubUid) {
|
||||
_.each(aRootUids, function (sSubUid) {
|
||||
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
||||
sFolderFullNameRaw, sSubUid, iSetAction);
|
||||
});
|
||||
|
|
@ -893,7 +882,7 @@
|
|||
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
|
||||
}
|
||||
|
||||
Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, bRoot ? aAllUids : aRootUids, true);
|
||||
Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, true);
|
||||
break;
|
||||
|
||||
case Enums.MessageSetAction.UnsetSeen:
|
||||
|
|
@ -925,13 +914,11 @@
|
|||
case Enums.MessageSetAction.UnsetFlag:
|
||||
|
||||
_.each(aRootUids, function (sSubUid) {
|
||||
// _.each(bRoot ? aAllUids : aRootUids, function (sSubUid) {
|
||||
Cache.storeMessageFlagsToCacheBySetAction(
|
||||
sFolderFullNameRaw, sSubUid, iSetAction);
|
||||
});
|
||||
|
||||
Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, false);
|
||||
// Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, bRoot ? aAllUids : aRootUids, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -978,7 +978,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
MessageModel.prototype.storeDataToDom = function ()
|
||||
MessageModel.prototype.storeDataInDom = function ()
|
||||
{
|
||||
if (this.body)
|
||||
{
|
||||
|
|
@ -997,7 +997,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
MessageModel.prototype.storePgpVerifyDataToDom = function ()
|
||||
MessageModel.prototype.storePgpVerifyDataInDom = function ()
|
||||
{
|
||||
if (this.body && require('Stores/User/Pgp').capaOpenPGP())
|
||||
{
|
||||
|
|
@ -1006,7 +1006,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
MessageModel.prototype.fetchDataToDom = function ()
|
||||
MessageModel.prototype.fetchDataFromDom = function ()
|
||||
{
|
||||
if (this.body)
|
||||
{
|
||||
|
|
@ -1090,7 +1090,7 @@
|
|||
}
|
||||
catch (oExc) {}
|
||||
|
||||
this.storePgpVerifyDataToDom();
|
||||
this.storePgpVerifyDataInDom();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1162,7 +1162,7 @@
|
|||
}
|
||||
catch (oExc) {}
|
||||
|
||||
this.storePgpVerifyDataToDom();
|
||||
this.storePgpVerifyDataInDom();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
// AppStore = require('Stores/User/App'),
|
||||
// SettingsStore = require('Stores/User/Settings'),
|
||||
|
||||
MessageSimpleModel = require('Model/MessageSimple'),
|
||||
|
||||
PromisesPopulator = require('Promises/User/Populator'),
|
||||
AbstractAjaxPromises = require('Promises/AbstractAjax')
|
||||
;
|
||||
|
|
|
|||
|
|
@ -327,6 +327,7 @@
|
|||
var
|
||||
self = this,
|
||||
iUnseenCount = 0,
|
||||
oMessage = null,
|
||||
aMessageList = this.messageList(),
|
||||
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
|
||||
oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
|
||||
|
|
@ -406,6 +407,56 @@
|
|||
{
|
||||
Cache.setFolderHash(sToFolderFullNameRaw, '');
|
||||
}
|
||||
|
||||
if ('' !== this.messageListThreadUid())
|
||||
{
|
||||
aMessageList = this.messageList();
|
||||
|
||||
if (aMessageList && 0 < aMessageList.length && !!_.find(aMessageList, function (oMessage) {
|
||||
return !!(oMessage && oMessage.deleted() && oMessage.uid === self.messageListThreadUid());
|
||||
}))
|
||||
{
|
||||
oMessage = _.find(aMessageList, function (oMessage) {
|
||||
return oMessage && !oMessage.deleted();
|
||||
});
|
||||
|
||||
if (oMessage && this.messageListThreadUid() !== Utils.pString(oMessage.uid))
|
||||
{
|
||||
this.messageListThreadUid(Utils.pString(oMessage.uid));
|
||||
|
||||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
this.messageListPage(),
|
||||
this.messageListSearch(),
|
||||
this.messageListThreadUid()
|
||||
), true, true);
|
||||
}
|
||||
else if (!oMessage)
|
||||
{
|
||||
if (1 < this.messageListPage())
|
||||
{
|
||||
this.messageListPage(this.messageListPage() - 1);
|
||||
|
||||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
this.messageListPage(),
|
||||
this.messageListSearch(),
|
||||
this.messageListThreadUid()
|
||||
), true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.messageListThreadUid('');
|
||||
|
||||
kn.setHash(Links.mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
this.messageListPageBeforeThread(),
|
||||
this.messageListSearch()
|
||||
), true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MessageUserStore.prototype.addBlockquoteSwitcherCallback = function ()
|
||||
|
|
@ -574,7 +625,7 @@
|
|||
oMessagesBodiesDom.append(oMessage.body);
|
||||
}
|
||||
|
||||
oMessage.storeDataToDom();
|
||||
oMessage.storeDataInDom();
|
||||
|
||||
if (bHasInternals)
|
||||
{
|
||||
|
|
@ -594,7 +645,7 @@
|
|||
if (oMessage.body)
|
||||
{
|
||||
oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
||||
oMessage.fetchDataToDom();
|
||||
oMessage.fetchDataFromDom();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -725,7 +776,6 @@
|
|||
oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
iIndex = 0,
|
||||
iLen = 0,
|
||||
iCount = 0,
|
||||
|
|
|
|||
|
|
@ -181,8 +181,8 @@ html.rl-no-preview-pane {
|
|||
.listThreadUidDesc {
|
||||
font-size: 16px;
|
||||
padding: 7px 20px 5px 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
background-color: #FCF8E3;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue