TF-1749 Handle delete drafts email after send email successfully
(cherry picked from commit bbef527d780425364660221271295a3fa733dcde)
This commit is contained in:
@@ -28,16 +28,3 @@ class EmailRequest with EquatableMixin {
|
|||||||
emailIdDestroyed
|
emailIdDestroyed
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
extension EmailRequestExtension on EmailRequest {
|
|
||||||
|
|
||||||
EmailRequest toEmailRequest({Email? newEmail}) {
|
|
||||||
return EmailRequest(
|
|
||||||
newEmail ?? email,
|
|
||||||
submissionCreateId,
|
|
||||||
sentMailboxId: sentMailboxId,
|
|
||||||
identity: identity,
|
|
||||||
emailIdDestroyed: emailIdDestroyed
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -40,6 +40,10 @@ class SendEmailInteractor {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
if (emailRequest.emailIdDestroyed != null) {
|
||||||
|
await _emailRepository.deleteEmailPermanently(session, accountId, emailRequest.emailIdDestroyed!);
|
||||||
|
}
|
||||||
|
|
||||||
yield Right<Failure, Success>(
|
yield Right<Failure, Success>(
|
||||||
SendEmailSuccess(
|
SendEmailSuccess(
|
||||||
currentEmailState: currentEmailState,
|
currentEmailState: currentEmailState,
|
||||||
|
|||||||
@@ -141,9 +141,6 @@ class EmailAPI with HandleSetErrorMixin {
|
|||||||
final setEmailMethod = SetEmailMethod(accountId)
|
final setEmailMethod = SetEmailMethod(accountId)
|
||||||
..addCreate(idCreateMethod, emailNeedsToBeCreated);
|
..addCreate(idCreateMethod, emailNeedsToBeCreated);
|
||||||
|
|
||||||
if (emailRequest.emailIdDestroyed != null) {
|
|
||||||
setEmailMethod.addDestroy({emailRequest.emailIdDestroyed!.id});
|
|
||||||
}
|
|
||||||
final setEmailInvocation = requestBuilder.invocation(setEmailMethod);
|
final setEmailInvocation = requestBuilder.invocation(setEmailMethod);
|
||||||
|
|
||||||
final setEmailSubmissionMethod = SetEmailSubmissionMethod(accountId)
|
final setEmailSubmissionMethod = SetEmailSubmissionMethod(accountId)
|
||||||
|
|||||||
Reference in New Issue
Block a user