mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 08:57:03 +03:00
Merge pull request #417 from edlerd/patch-1
Fix performance on threaded view in large folders
This commit is contained in:
commit
6cea49d316
1 changed files with 10 additions and 9 deletions
|
|
@ -901,10 +901,12 @@ class MailClient
|
||||||
$aUids = $this->GetUids($oParams->oCacher, '',
|
$aUids = $this->GetUids($oParams->oCacher, '',
|
||||||
$oMessageCollection->FolderName, $oMessageCollection->FolderHash, $bUseSortIfSupported, $oParams->sSort);
|
$oMessageCollection->FolderName, $oMessageCollection->FolderHash, $bUseSortIfSupported, $oParams->sSort);
|
||||||
// Remove all threaded UID's except the most recent of each thread
|
// Remove all threaded UID's except the most recent of each thread
|
||||||
|
$threadedUids = [];
|
||||||
foreach ($aAllThreads as $aMap) {
|
foreach ($aAllThreads as $aMap) {
|
||||||
unset($aMap[\array_key_last($aMap)]);
|
unset($aMap[\array_key_last($aMap)]);
|
||||||
$aUids = \array_diff($aUids, $aMap);
|
$threadedUids = \array_merge($threadedUids, $aMap);
|
||||||
}
|
}
|
||||||
|
$aUids = \array_diff($aUids, $threadedUids);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$aUids = $this->GetUids($oParams->oCacher, '',
|
$aUids = $this->GetUids($oParams->oCacher, '',
|
||||||
|
|
@ -916,15 +918,14 @@ class MailClient
|
||||||
$aSearchedUids = $this->GetUids($oParams->oCacher, $sSearch,
|
$aSearchedUids = $this->GetUids($oParams->oCacher, $sSearch,
|
||||||
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
|
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
|
||||||
if ($bUseThreads && !$oParams->iThreadUid) {
|
if ($bUseThreads && !$oParams->iThreadUid) {
|
||||||
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids, $aAllThreads) {
|
$matchingThreadUids = [];
|
||||||
if (\in_array($iUid, $aSearchedUids)) {
|
foreach ($aAllThreads as $aMap) {
|
||||||
return true;
|
if (\array_intersect($aSearchedUids, $aMap)) {
|
||||||
}
|
$matchingThreadUids = \array_merge($matchingThreadUids, $aMap);
|
||||||
foreach ($aAllThreads as $aMap) {
|
|
||||||
if (\in_array($iUid, $aMap) && \array_intersect($aSearchedUids, $aMap)) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids, $matchingThreadUids) {
|
||||||
|
return \in_array($iUid, $aSearchedUids) || \in_array($iUid, $matchingThreadUids);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids) {
|
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue