TF-1759: Check when replying and all replies will include me in the recipient!
(cherry picked from commit f6481d05c18855a03d2b1cb2d4b94496d5b21d5b)
This commit is contained in:
@@ -535,13 +535,22 @@ class ComposerController extends BaseController {
|
||||
void _initEmailAddress(ComposerArguments arguments) {
|
||||
final userProfile = mailboxDashBoardController.userProfile.value;
|
||||
if (arguments.presentationEmail != null && userProfile != null) {
|
||||
final userEmailAddress = EmailAddress(null, userProfile.email);
|
||||
final recipients = arguments.presentationEmail!.generateRecipientsEmailAddressForComposer(
|
||||
arguments.emailActionType,
|
||||
arguments.mailboxRole);
|
||||
arguments.emailActionType,
|
||||
arguments.mailboxRole);
|
||||
|
||||
listToEmailAddress = List.from(recipients.value1);
|
||||
listCcEmailAddress = List.from(recipients.value2);
|
||||
listBccEmailAddress = List.from(recipients.value3);
|
||||
final isSender = arguments.presentationEmail!.from.asList().every((element) => element.email == userEmailAddress.email);
|
||||
|
||||
if (isSender) {
|
||||
listToEmailAddress = List.from(recipients.value1);
|
||||
listCcEmailAddress = List.from(recipients.value2);
|
||||
listBccEmailAddress = List.from(recipients.value3);
|
||||
} else {
|
||||
listToEmailAddress = List.from(recipients.value1.toSet().filterEmailAddress(userEmailAddress));
|
||||
listCcEmailAddress = List.from(recipients.value2.toSet().filterEmailAddress(userEmailAddress));
|
||||
listBccEmailAddress = List.from(recipients.value3.toSet().filterEmailAddress(userEmailAddress));
|
||||
}
|
||||
|
||||
if (listToEmailAddress.isNotEmpty || listCcEmailAddress.isNotEmpty || listBccEmailAddress.isNotEmpty) {
|
||||
isInitialRecipient.value = true;
|
||||
|
||||
@@ -26,4 +26,10 @@ extension ListEmailAddressExtension on Set<EmailAddress>? {
|
||||
}
|
||||
|
||||
int numberEmailAddress() => this != null ? this!.length : 0;
|
||||
|
||||
List<EmailAddress> filterEmailAddress(EmailAddress emailAddressNotExist) {
|
||||
return this != null
|
||||
? this!.where((emailAddress) => emailAddress.email != emailAddressNotExist.email).toList()
|
||||
: List.empty();
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
if (mailboxRole == PresentationMailbox.roleSent) {
|
||||
return Tuple3(to.asList(), [], []);
|
||||
} else {
|
||||
final replyToAddress = replyTo.asList().isNotEmpty ? replyTo.asList() : from.asList();
|
||||
final replyToAddress = replyTo.asList().isNotEmpty ? to.asList() + replyTo.asList() : from.asList();
|
||||
return Tuple3(replyToAddress, [], []);
|
||||
}
|
||||
case EmailActionType.replyAll:
|
||||
|
||||
Reference in New Issue
Block a user