Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Lost update between last draft and sending a message #8743

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

hamza221
Copy link
Contributor

fixes #8734

lib/Controller/DraftsController.php Outdated Show resolved Hide resolved
lib/Service/DraftsService.php Outdated Show resolved Hide resolved
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 lost update is no longer lost

but I found a new logic flaw 🥲

? $message->setType(LocalMessage::TYPE_OUTGOING)
: $message->setType(LocalMessage::TYPE_DRAFT);

$message->setType(LocalMessage::TYPE_DRAFT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\OCA\Mail\Controller\DraftsController::create still has the same logic and it is in use

  1. Compose a new message
  2. Send it before the first draft

There is a POST to create the draft but it results in implicit conversion to an outbox message.

Expectation is that the draft is created, then converted to an outbox message.

@hamza221
Copy link
Contributor Author

hamza221 commented Aug 17, 2023

The removed test doesn't make sense anymore in DraftServiceTest, because if I didn't make any mistakes or forgot an edge case. LocalMessages will never have type outbox in the draft service

@GretaD
Copy link
Contributor

GretaD commented Aug 17, 2023

so, ready to get merged? :)

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Messages that are sent right away and those that are a draft first are sent as expected 🙏 ☺️

@@ -373,54 +373,6 @@ public function testConvertToOutboxMessage(): void {
$this->draftsService->updateMessage($account, $message, $to, $cc, $bcc, $attachments);
}

public function testConvertToOutboxMessageNoRecipients(): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, the test makes no sense anymore because we just dropped the implicit conversion 👍

@GretaD
Copy link
Contributor

GretaD commented Aug 17, 2023

/backport to stable3.3

@GretaD GretaD merged commit 174e4a0 into main Aug 17, 2023
29 checks passed
@GretaD GretaD deleted the fix/local-draft branch August 17, 2023 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lost update between last draft and sending a message
4 participants