diff options
author | Anna Larch <anna@nextcloud.com> | 2021-03-23 19:22:02 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-03-25 11:45:09 +0300 |
commit | 00ea4273322ca18746d9a21714869c47ca2a1ea0 (patch) | |
tree | 0dc1cc28c693ee0149afd8d778cfd838744b0719 /lib/Service | |
parent | 7bc1cb1f64294236dcab0f24d4757399539c7524 (diff) |
Add time check to hasLocks
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/Search/MailSearch.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Service/Search/MailSearch.php b/lib/Service/Search/MailSearch.php index 582944c22..fc233689b 100644 --- a/lib/Service/Search/MailSearch.php +++ b/lib/Service/Search/MailSearch.php @@ -39,6 +39,7 @@ use OCA\Mail\Exception\ServiceException; use OCA\Mail\IMAP\PreviewEnhancer; use OCA\Mail\IMAP\Search\Provider as ImapSearchProvider; use OCP\AppFramework\Db\DoesNotExistException; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\IUser; class MailSearch implements IMailSearch { @@ -58,16 +59,21 @@ class MailSearch implements IMailSearch { /** @var PreviewEnhancer */ private $previewEnhancer; + /** @var ITimeFactory */ + private $timeFactory; + public function __construct(FilterStringParser $filterStringParser, MailboxMapper $mailboxMapper, ImapSearchProvider $imapSearchProvider, MessageMapper $messageMapper, - PreviewEnhancer $previewEnhancer) { + PreviewEnhancer $previewEnhancer, + ITimeFactory $timeFactory) { $this->filterStringParser = $filterStringParser; $this->mailboxMapper = $mailboxMapper; $this->imapSearchProvider = $imapSearchProvider; $this->messageMapper = $messageMapper; $this->previewEnhancer = $previewEnhancer; + $this->timeFactory = $timeFactory; } public function findMessage(Account $account, @@ -101,7 +107,7 @@ class MailSearch implements IMailSearch { ?string $filter, ?int $cursor, ?int $limit): array { - if ($mailbox->hasLocks()) { + if ($mailbox->hasLocks($this->timeFactory->getTime())) { throw MailboxLockedException::from($mailbox); } if (!$mailbox->isCached()) { |