nextcloud / nextcloud/mail

Incomplete/Missing error handling in NewMessageModal.onSend

Open
#9,840 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug regression
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Steps to reproduce
  1. Write an email
  2. Click send
  3. An error, from the backend, is not properly handled
Expected behavior

As a User, I expected a hint/warning when something went wrong.

Actual behavior

Nothing.

To do
  • Remove dead code
  • Show a warning when the backend operation failed
Additional info

https://github.com/nextcloud/mail/blob/c1d14c4fa32f8d66543db9dc2402d5914127d7d8/src/components/NewMessageModal.vue#L416-L441

  • NoSentMailboxConfiguredError and ManyRecipientsError are mapped from the backend exceptions^1, but the backend does not throw SentMailboxNotSetException and ManyRecipientsException anymore.
  • The phpdoc for IMailTransmission.sendMessage is outdated.
  • NewMessageModal.onSend may put a draft into the outbox without having a draft saved already (1), update a message in the outbox (2), update an existing draft and put it into the outbox (3).

To simulate a failure for case 1 or 3:

Index: lib/Controller/OutboxController.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/Controller/OutboxController.php b/lib/Controller/OutboxController.php
--- a/lib/Controller/OutboxController.php	(revision 2cfa6995f9de4d356a28e32c4f12ccf74a679717)
+++ b/lib/Controller/OutboxController.php	(date 1720696979685)
@@ -145,6 +145,8 @@
		// Locate the account to check authorization
		$this->accountService->find($this->userId, $draftMessage->getAccountId());

+		throw new ClientException('Computer says no');
+
		$outboxMessage = $this->service->convertDraft($draftMessage, $sendAt);

		return JsonResponse::success(

Screencast from 2024-07-11 13-24-49.webm

There's no feedback that something went wrong, I'm just taking back to the composer, and it says, "Draft saved".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with NewMessageModal.vue around onSend and the error mappings in src/errors/convert.js; use the provided OutboxController.php failure injection to reproduce the missing feedback. Trace the draft and outbox cases, then verify that backend failures produce a warning rather than a false “Draft saved” message and that the obsolete error mappings and IMailTransmission.sendMessage phpdoc are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.