mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +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)
|
if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition)
|
||||||
{
|
{
|
||||||
MessageStore.messageListPage(1);
|
MessageStore.messageListPage(1);
|
||||||
|
MessageStore.messageListPageBeforeThread(1);
|
||||||
iOffset = 0;
|
iOffset = 0;
|
||||||
|
|
||||||
|
kn.setHash(Links.mailBox(
|
||||||
|
FolderStore.currentFolderFullNameHash(),
|
||||||
|
MessageStore.messageListPage(),
|
||||||
|
MessageStore.messageListSearch(),
|
||||||
|
MessageStore.messageListThreadUid()
|
||||||
|
), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageStore.messageListLoading(true);
|
MessageStore.messageListLoading(true);
|
||||||
|
|
@ -844,10 +852,8 @@
|
||||||
AppUser.prototype.messageListAction = function (sFolderFullNameRaw, mUid, iSetAction, aMessages)
|
AppUser.prototype.messageListAction = function (sFolderFullNameRaw, mUid, iSetAction, aMessages)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
bRoot = false,
|
|
||||||
aAllUids = [],
|
|
||||||
aRootUids = [],
|
|
||||||
oFolder = null,
|
oFolder = null,
|
||||||
|
aRootUids = [],
|
||||||
iAlreadyUnread = 0
|
iAlreadyUnread = 0
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -856,33 +862,16 @@
|
||||||
aMessages = MessageStore.messageListChecked();
|
aMessages = MessageStore.messageListChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true === mUid)
|
aRootUids = _.uniq(_.compact(_.map(aMessages, function (oMessage) {
|
||||||
{
|
return (oMessage && oMessage.uid) ? oMessage.uid : null;
|
||||||
bRoot = true;
|
})));
|
||||||
}
|
|
||||||
else if (aMessages && aMessages[0] && mUid &&
|
|
||||||
sFolderFullNameRaw === aMessages[0].folderFullNameRaw && mUid === aMessages[0].uid)
|
|
||||||
{
|
|
||||||
bRoot = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_.each(aMessages, function (oMessage) {
|
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
switch (iSetAction) {
|
switch (iSetAction) {
|
||||||
case Enums.MessageSetAction.SetSeen:
|
case Enums.MessageSetAction.SetSeen:
|
||||||
|
|
||||||
_.each(bRoot ? aAllUids : aRootUids, function (sSubUid) {
|
_.each(aRootUids, function (sSubUid) {
|
||||||
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
||||||
sFolderFullNameRaw, sSubUid, iSetAction);
|
sFolderFullNameRaw, sSubUid, iSetAction);
|
||||||
});
|
});
|
||||||
|
|
@ -893,7 +882,7 @@
|
||||||
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
|
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
|
||||||
}
|
}
|
||||||
|
|
||||||
Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, bRoot ? aAllUids : aRootUids, true);
|
Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Enums.MessageSetAction.UnsetSeen:
|
case Enums.MessageSetAction.UnsetSeen:
|
||||||
|
|
@ -925,13 +914,11 @@
|
||||||
case Enums.MessageSetAction.UnsetFlag:
|
case Enums.MessageSetAction.UnsetFlag:
|
||||||
|
|
||||||
_.each(aRootUids, function (sSubUid) {
|
_.each(aRootUids, function (sSubUid) {
|
||||||
// _.each(bRoot ? aAllUids : aRootUids, function (sSubUid) {
|
|
||||||
Cache.storeMessageFlagsToCacheBySetAction(
|
Cache.storeMessageFlagsToCacheBySetAction(
|
||||||
sFolderFullNameRaw, sSubUid, iSetAction);
|
sFolderFullNameRaw, sSubUid, iSetAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, false);
|
Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, false);
|
||||||
// Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, bRoot ? aAllUids : aRootUids, false);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -978,7 +978,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.storeDataToDom = function ()
|
MessageModel.prototype.storeDataInDom = function ()
|
||||||
{
|
{
|
||||||
if (this.body)
|
if (this.body)
|
||||||
{
|
{
|
||||||
|
|
@ -997,7 +997,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.storePgpVerifyDataToDom = function ()
|
MessageModel.prototype.storePgpVerifyDataInDom = function ()
|
||||||
{
|
{
|
||||||
if (this.body && require('Stores/User/Pgp').capaOpenPGP())
|
if (this.body && require('Stores/User/Pgp').capaOpenPGP())
|
||||||
{
|
{
|
||||||
|
|
@ -1006,7 +1006,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.fetchDataToDom = function ()
|
MessageModel.prototype.fetchDataFromDom = function ()
|
||||||
{
|
{
|
||||||
if (this.body)
|
if (this.body)
|
||||||
{
|
{
|
||||||
|
|
@ -1090,7 +1090,7 @@
|
||||||
}
|
}
|
||||||
catch (oExc) {}
|
catch (oExc) {}
|
||||||
|
|
||||||
this.storePgpVerifyDataToDom();
|
this.storePgpVerifyDataInDom();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1162,7 +1162,7 @@
|
||||||
}
|
}
|
||||||
catch (oExc) {}
|
catch (oExc) {}
|
||||||
|
|
||||||
this.storePgpVerifyDataToDom();
|
this.storePgpVerifyDataInDom();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@
|
||||||
// AppStore = require('Stores/User/App'),
|
// AppStore = require('Stores/User/App'),
|
||||||
// SettingsStore = require('Stores/User/Settings'),
|
// SettingsStore = require('Stores/User/Settings'),
|
||||||
|
|
||||||
MessageSimpleModel = require('Model/MessageSimple'),
|
|
||||||
|
|
||||||
PromisesPopulator = require('Promises/User/Populator'),
|
PromisesPopulator = require('Promises/User/Populator'),
|
||||||
AbstractAjaxPromises = require('Promises/AbstractAjax')
|
AbstractAjaxPromises = require('Promises/AbstractAjax')
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,7 @@
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
iUnseenCount = 0,
|
iUnseenCount = 0,
|
||||||
|
oMessage = null,
|
||||||
aMessageList = this.messageList(),
|
aMessageList = this.messageList(),
|
||||||
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
|
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
|
||||||
oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
|
oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
|
||||||
|
|
@ -406,6 +407,56 @@
|
||||||
{
|
{
|
||||||
Cache.setFolderHash(sToFolderFullNameRaw, '');
|
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 ()
|
MessageUserStore.prototype.addBlockquoteSwitcherCallback = function ()
|
||||||
|
|
@ -574,7 +625,7 @@
|
||||||
oMessagesBodiesDom.append(oMessage.body);
|
oMessagesBodiesDom.append(oMessage.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
oMessage.storeDataToDom();
|
oMessage.storeDataInDom();
|
||||||
|
|
||||||
if (bHasInternals)
|
if (bHasInternals)
|
||||||
{
|
{
|
||||||
|
|
@ -594,7 +645,7 @@
|
||||||
if (oMessage.body)
|
if (oMessage.body)
|
||||||
{
|
{
|
||||||
oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
||||||
oMessage.fetchDataToDom();
|
oMessage.fetchDataFromDom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -725,7 +776,6 @@
|
||||||
oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
|
oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
iLen = 0,
|
iLen = 0,
|
||||||
iCount = 0,
|
iCount = 0,
|
||||||
|
|
|
||||||
|
|
@ -181,8 +181,8 @@ html.rl-no-preview-pane {
|
||||||
.listThreadUidDesc {
|
.listThreadUidDesc {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 7px 20px 5px 20px;
|
padding: 7px 20px 5px 20px;
|
||||||
border-bottom: 1px solid #eee;
|
background-color: #999;
|
||||||
background-color: #FCF8E3;
|
color: #fff;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "RainLoop",
|
"name": "RainLoop",
|
||||||
"title": "RainLoop Webmail",
|
"title": "RainLoop Webmail",
|
||||||
"version": "1.8.3",
|
"version": "1.8.3",
|
||||||
"release": "304",
|
"release": "305",
|
||||||
"description": "Simple, modern & fast web-based email client",
|
"description": "Simple, modern & fast web-based email client",
|
||||||
"homepage": "http://rainloop.net",
|
"homepage": "http://rainloop.net",
|
||||||
"main": "gulpfile.js",
|
"main": "gulpfile.js",
|
||||||
|
|
|
||||||
|
|
@ -2079,11 +2079,8 @@ class MailClient
|
||||||
|
|
||||||
if (0 < $iMessageRealCount)
|
if (0 < $iMessageRealCount)
|
||||||
{
|
{
|
||||||
$mAllSortedUids = $this->GetUids($oCacher, '', $oMessageCollection->FolderName, $oMessageCollection->FolderHash, $bUseSortIfSupported);
|
$mAllSortedUids = $this->GetUids($oCacher, '',
|
||||||
|
$oMessageCollection->FolderName, $oMessageCollection->FolderHash, $bUseSortIfSupported);
|
||||||
$bUseSortIfSupported = $bUseSortIfSupported ? $this->oImapClient->IsSupported('SORT') : false;
|
|
||||||
|
|
||||||
// $bUseThreadSortIfSupported = $bUseThreadSortIfSupported ?
|
|
||||||
|
|
||||||
$mAllThreads = $bUseThreadSortIfSupported ? $this->MessageListThreadsMap(
|
$mAllThreads = $bUseThreadSortIfSupported ? $this->MessageListThreadsMap(
|
||||||
$oMessageCollection->FolderName, $oMessageCollection->FolderHash, $mAllSortedUids, $oCacher) : null;
|
$oMessageCollection->FolderName, $oMessageCollection->FolderHash, $mAllSortedUids, $oCacher) : null;
|
||||||
|
|
@ -2091,12 +2088,32 @@ class MailClient
|
||||||
if ($bUseThreadSortIfSupported && 0 < $iThreadUid && \is_array($mAllThreads))
|
if ($bUseThreadSortIfSupported && 0 < $iThreadUid && \is_array($mAllThreads))
|
||||||
{
|
{
|
||||||
$aUids = array();
|
$aUids = array();
|
||||||
$aUids = \is_array($mAllThreads[$iThreadUid]) ?
|
$iResultRootUid = 0;
|
||||||
$mAllThreads[$iThreadUid] : array();
|
|
||||||
|
if (isset($mAllThreads[$iThreadUid]))
|
||||||
if (\in_array($iThreadUid, $mAllSortedUids))
|
|
||||||
{
|
{
|
||||||
\array_unshift($aUids, $iThreadUid);
|
$iResultRootUid = $iThreadUid;
|
||||||
|
if (\is_array($mAllThreads[$iThreadUid]))
|
||||||
|
{
|
||||||
|
$aUids = $mAllThreads[$iThreadUid];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ($mAllThreads as $iRootUid => $mSubUids)
|
||||||
|
{
|
||||||
|
if (\is_array($mSubUids) && \in_array($iThreadUid, $mSubUids))
|
||||||
|
{
|
||||||
|
$iResultRootUid = $iRootUid;
|
||||||
|
$aUids = $mSubUids;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < $iResultRootUid && \in_array($iResultRootUid, $mAllSortedUids))
|
||||||
|
{
|
||||||
|
\array_unshift($aUids, $iResultRootUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($bUseThreadSortIfSupported && \is_array($mAllThreads))
|
else if ($bUseThreadSortIfSupported && \is_array($mAllThreads))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue