MessageResultCount to JMAP totalEmails

This commit is contained in:
the-djmaze 2022-12-13 14:04:43 +01:00
parent df8e4d2b9d
commit f8f8cd0124
4 changed files with 11 additions and 8 deletions

View file

@ -18,7 +18,6 @@ export class MessageCollectionModel extends AbstractCollectionModel
this.FolderInfo
this.totalEmails
this.unreadEmails
this.MessageResultCount
this.UidNext
this.ThreadUid
this.NewMessages

View file

@ -258,7 +258,7 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
MessagelistUserStore.notifyNewMessages(folder.fullName, collection.NewMessages);
}
MessagelistUserStore.count(collection.MessageResultCount);
MessagelistUserStore.count(collection.totalEmails);
MessagelistUserStore.listSearch(pString(collection.Search));
MessagelistUserStore.page(Math.ceil(collection.Offset / SettingsUserStore.messagesPerPage() + 1));
MessagelistUserStore.threadUid(collection.ThreadUid);

View file

@ -802,15 +802,15 @@ class MailClient
$aUids = $this->GetUids($oParams, $sSearch,
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
$oMessageCollection->MessageResultCount = \count($aUids);
if ($oMessageCollection->MessageResultCount) {
$oMessageCollection->totalEmails = \count($aUids);
if ($oMessageCollection->totalEmails) {
$this->MessageListByRequestIndexOrUids(
$oMessageCollection,
new SequenceSet(\array_slice($aUids, $oParams->iOffset, $oParams->iLimit))
);
}
} else {
$oMessageCollection->MessageResultCount = $oInfo->MESSAGES;
$oMessageCollection->totalEmails = $oInfo->MESSAGES;
if (1 < $oInfo->MESSAGES) {
$end = \max(1, $oInfo->MESSAGES - $oParams->iOffset);
$start = \max(1, $end - $oParams->iLimit + 1);
@ -825,6 +825,7 @@ class MailClient
$bUseSortIfSupported = $oParams->bUseSortIfSupported && $this->oImapClient->IsSupported('SORT');
if ($bUseThreads) {
$aAllThreads = $this->MessageListThreadsMap($oMessageCollection->FolderName, $oMessageCollection->FolderHash, $oParams->oCacher);
$oMessageCollection->totalThreads = \count($aAllThreads);
// $iThreadLimit = $this->oImapClient->Settings->thread_limit;
if ($oParams->iThreadUid) {
$aUids = [$oParams->iThreadUid];
@ -871,7 +872,7 @@ class MailClient
}
}
$oMessageCollection->MessageResultCount = \count($aUids);
$oMessageCollection->totalEmails = \count($aUids);
if (\count($aUids)) {
$this->MessageListByRequestIndexOrUids(

View file

@ -22,7 +22,9 @@ class MessageCollection extends \MailSo\Base\Collection
/**
* Amount of UIDs in this list (could be less then total messages when using threads)
*/
public int $MessageResultCount = 0;
public int $totalEmails = 0;
public ?int $totalThreads = null;
public string $FolderName = '';
@ -56,7 +58,8 @@ class MessageCollection extends \MailSo\Base\Collection
public function jsonSerialize()
{
return array_merge(parent::jsonSerialize(), array(
'MessageResultCount' => $this->MessageResultCount,
'totalEmails' => $this->totalEmails,
'totalThreads' => $this->totalThreads,
'Folder' => $this->FolderName,
'FolderHash' => $this->FolderHash,
'FolderInfo' => $this->FolderInfo,