mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
MessageResultCount to JMAP totalEmails
This commit is contained in:
parent
df8e4d2b9d
commit
f8f8cd0124
4 changed files with 11 additions and 8 deletions
|
|
@ -18,7 +18,6 @@ export class MessageCollectionModel extends AbstractCollectionModel
|
||||||
this.FolderInfo
|
this.FolderInfo
|
||||||
this.totalEmails
|
this.totalEmails
|
||||||
this.unreadEmails
|
this.unreadEmails
|
||||||
this.MessageResultCount
|
|
||||||
this.UidNext
|
this.UidNext
|
||||||
this.ThreadUid
|
this.ThreadUid
|
||||||
this.NewMessages
|
this.NewMessages
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
|
||||||
MessagelistUserStore.notifyNewMessages(folder.fullName, collection.NewMessages);
|
MessagelistUserStore.notifyNewMessages(folder.fullName, collection.NewMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagelistUserStore.count(collection.MessageResultCount);
|
MessagelistUserStore.count(collection.totalEmails);
|
||||||
MessagelistUserStore.listSearch(pString(collection.Search));
|
MessagelistUserStore.listSearch(pString(collection.Search));
|
||||||
MessagelistUserStore.page(Math.ceil(collection.Offset / SettingsUserStore.messagesPerPage() + 1));
|
MessagelistUserStore.page(Math.ceil(collection.Offset / SettingsUserStore.messagesPerPage() + 1));
|
||||||
MessagelistUserStore.threadUid(collection.ThreadUid);
|
MessagelistUserStore.threadUid(collection.ThreadUid);
|
||||||
|
|
|
||||||
|
|
@ -802,15 +802,15 @@ class MailClient
|
||||||
$aUids = $this->GetUids($oParams, $sSearch,
|
$aUids = $this->GetUids($oParams, $sSearch,
|
||||||
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
|
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
|
||||||
|
|
||||||
$oMessageCollection->MessageResultCount = \count($aUids);
|
$oMessageCollection->totalEmails = \count($aUids);
|
||||||
if ($oMessageCollection->MessageResultCount) {
|
if ($oMessageCollection->totalEmails) {
|
||||||
$this->MessageListByRequestIndexOrUids(
|
$this->MessageListByRequestIndexOrUids(
|
||||||
$oMessageCollection,
|
$oMessageCollection,
|
||||||
new SequenceSet(\array_slice($aUids, $oParams->iOffset, $oParams->iLimit))
|
new SequenceSet(\array_slice($aUids, $oParams->iOffset, $oParams->iLimit))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$oMessageCollection->MessageResultCount = $oInfo->MESSAGES;
|
$oMessageCollection->totalEmails = $oInfo->MESSAGES;
|
||||||
if (1 < $oInfo->MESSAGES) {
|
if (1 < $oInfo->MESSAGES) {
|
||||||
$end = \max(1, $oInfo->MESSAGES - $oParams->iOffset);
|
$end = \max(1, $oInfo->MESSAGES - $oParams->iOffset);
|
||||||
$start = \max(1, $end - $oParams->iLimit + 1);
|
$start = \max(1, $end - $oParams->iLimit + 1);
|
||||||
|
|
@ -825,6 +825,7 @@ class MailClient
|
||||||
$bUseSortIfSupported = $oParams->bUseSortIfSupported && $this->oImapClient->IsSupported('SORT');
|
$bUseSortIfSupported = $oParams->bUseSortIfSupported && $this->oImapClient->IsSupported('SORT');
|
||||||
if ($bUseThreads) {
|
if ($bUseThreads) {
|
||||||
$aAllThreads = $this->MessageListThreadsMap($oMessageCollection->FolderName, $oMessageCollection->FolderHash, $oParams->oCacher);
|
$aAllThreads = $this->MessageListThreadsMap($oMessageCollection->FolderName, $oMessageCollection->FolderHash, $oParams->oCacher);
|
||||||
|
$oMessageCollection->totalThreads = \count($aAllThreads);
|
||||||
// $iThreadLimit = $this->oImapClient->Settings->thread_limit;
|
// $iThreadLimit = $this->oImapClient->Settings->thread_limit;
|
||||||
if ($oParams->iThreadUid) {
|
if ($oParams->iThreadUid) {
|
||||||
$aUids = [$oParams->iThreadUid];
|
$aUids = [$oParams->iThreadUid];
|
||||||
|
|
@ -871,7 +872,7 @@ class MailClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMessageCollection->MessageResultCount = \count($aUids);
|
$oMessageCollection->totalEmails = \count($aUids);
|
||||||
|
|
||||||
if (\count($aUids)) {
|
if (\count($aUids)) {
|
||||||
$this->MessageListByRequestIndexOrUids(
|
$this->MessageListByRequestIndexOrUids(
|
||||||
|
|
|
||||||
|
|
@ -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)
|
* 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 = '';
|
public string $FolderName = '';
|
||||||
|
|
||||||
|
|
@ -56,7 +58,8 @@ class MessageCollection extends \MailSo\Base\Collection
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return array_merge(parent::jsonSerialize(), array(
|
return array_merge(parent::jsonSerialize(), array(
|
||||||
'MessageResultCount' => $this->MessageResultCount,
|
'totalEmails' => $this->totalEmails,
|
||||||
|
'totalThreads' => $this->totalThreads,
|
||||||
'Folder' => $this->FolderName,
|
'Folder' => $this->FolderName,
|
||||||
'FolderHash' => $this->FolderHash,
|
'FolderHash' => $this->FolderHash,
|
||||||
'FolderInfo' => $this->FolderInfo,
|
'FolderInfo' => $this->FolderInfo,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue