Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Sazanov <m@sazanof.ru>2022-06-17 15:38:51 +0300
committerMikhail Sazanov <m@sazanof.ru>2022-06-17 15:38:51 +0300
commit53489c649dce81caaf65dd6717a522f95212df22 (patch)
tree21df35b3f9e2dbe33af5796d3798e8473548867a /lib/Controller
parent7ad8b9626d1b70ab3c68fa601439d2f6a1b57964 (diff)
Users can clear their mailboxes
Signed-off-by: Mikhail Sazanov <m@sazanof.ru>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/MailboxesController.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Controller/MailboxesController.php b/lib/Controller/MailboxesController.php
index e69232ef5..a648ebb10 100644
--- a/lib/Controller/MailboxesController.php
+++ b/lib/Controller/MailboxesController.php
@@ -284,4 +284,22 @@ class MailboxesController extends Controller {
$this->mailManager->deleteMailbox($account, $mailbox);
return new JSONResponse();
}
+
+ /**
+ * @NoAdminRequired
+ * @TrapError
+ *
+ * @param int $id
+ *
+ * @return JSONResponse
+ * @throws ClientException
+ * @throws ServiceException
+ */
+ public function clearMailbox(int $id): JSONResponse {
+ $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id);
+ $account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId());
+
+ $this->mailManager->clearMailbox($account, $mailbox);
+ return new JSONResponse();
+ }
}