TF-103 [BUG] Given a mail in sent box, i open it, click reply, it sends it to myself
This commit is contained in:
@@ -6,6 +6,8 @@ extension ListEmailAddressExtension on Set<EmailAddress>? {
|
||||
|
||||
List<String>? getListAddress() => this?.map((emailAddress) => emailAddress.getEmail()).toList();
|
||||
|
||||
List<EmailAddress> asList() => this != null ? this!.toList() : List.empty();
|
||||
|
||||
List<String> getListEmailAddress({ExpandMode expandMode = ExpandMode.EXPAND, int limitAddress = 1, bool isFullEmailAddress = false}) {
|
||||
if (this != null) {
|
||||
if (expandMode == ExpandMode.EXPAND) {
|
||||
@@ -24,4 +26,11 @@ 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();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
extension PresentationEmailExtension on PresentationEmail {
|
||||
@@ -18,7 +21,7 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
|
||||
PresentationEmail toggleSelect() {
|
||||
return PresentationEmail(
|
||||
id,
|
||||
this.id,
|
||||
keywords: keywords,
|
||||
size: size,
|
||||
receivedAt: receivedAt,
|
||||
@@ -37,7 +40,7 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
|
||||
PresentationEmail toSelectedEmail({required SelectMode selectMode}) {
|
||||
return PresentationEmail(
|
||||
id,
|
||||
this.id,
|
||||
keywords: keywords,
|
||||
size: size,
|
||||
receivedAt: receivedAt,
|
||||
@@ -56,7 +59,7 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
|
||||
Email toEmail() {
|
||||
return Email(
|
||||
id,
|
||||
this.id,
|
||||
keywords: keywords,
|
||||
size: size,
|
||||
receivedAt: receivedAt,
|
||||
@@ -75,4 +78,27 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
String recipientsName() {
|
||||
return to.listEmailAddressToString() + cc.listEmailAddressToString() + bcc.listEmailAddressToString();
|
||||
}
|
||||
|
||||
Tuple3<List<EmailAddress>, List<EmailAddress>, List<EmailAddress>> generateRecipientsEmailAddressForComposer(
|
||||
EmailActionType? emailActionType,
|
||||
Role? mailboxRole
|
||||
) {
|
||||
switch(emailActionType) {
|
||||
case EmailActionType.reply:
|
||||
if (mailboxRole == PresentationMailbox.roleSent) {
|
||||
return Tuple3(to.asList(), [], []);
|
||||
} else {
|
||||
final replyToAddress = replyTo.asList().isNotEmpty ? replyTo.asList() : from.asList();
|
||||
return Tuple3(replyToAddress, [], []);
|
||||
}
|
||||
case EmailActionType.replyAll:
|
||||
if (mailboxRole == PresentationMailbox.roleSent) {
|
||||
return Tuple3(to.asList(), cc.asList(), bcc.asList());
|
||||
} else {
|
||||
return Tuple3(to.asList() + from.asList(), cc.asList(), bcc.asList());
|
||||
}
|
||||
default:
|
||||
return Tuple3([], [], []);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user