TF-3189 new reply to field in the mail composer

This commit is contained in:
Florent Azavant
2024-10-30 16:02:00 +01:00
committed by Dat H. Pham
parent 78be3e4d79
commit 74fc8d5d72
20 changed files with 354 additions and 31 deletions
@@ -47,6 +47,7 @@ void main() {
toRecipients: {},
ccRecipients: {},
bccRecipients: {},
replyToRecipients: {},
draftsEmailId: EmailId(Id('some-id'))
);
when(composerRepository.generateEmail(any, withIdentityHeader: anyNamed('withIdentityHeader')))
@@ -85,6 +86,7 @@ void main() {
toRecipients: {},
ccRecipients: {},
bccRecipients: {},
replyToRecipients: {},
);
when(composerRepository.generateEmail(any, withIdentityHeader: anyNamed('withIdentityHeader')))
.thenAnswer((_) async => Email());
@@ -38,6 +38,7 @@ void main() {
toRecipients: {},
ccRecipients: {},
bccRecipients: {},
replyToRecipients: {},
);
when(composerRepository.generateEmail(any, withIdentityHeader: anyNamed('withIdentityHeader')))
.thenAnswer((_) async => Email());
@@ -306,6 +306,7 @@ void main() {
final toRecipient = EmailAddress('to', 'to@linagora.com');
final ccRecipient = EmailAddress('cc', 'cc@linagora.com');
final bccRecipient = EmailAddress('bcc', 'bcc@linagora.com');
final replyToRecipient = EmailAddress('replyTo', 'replyTo@linagora.com');
final identity = Identity();
final attachment = Attachment();
const alwaysReadReceiptEnabled = true;
@@ -331,6 +332,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
composerController?.identitySelected.value = identity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
final state = GetAlwaysReadReceiptSettingSuccess(
@@ -342,6 +344,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: alwaysReadReceiptEnabled
@@ -370,6 +373,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
composerController?.identitySelected.value = identity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
final state = GetAlwaysReadReceiptSettingFailure(Exception());
@@ -380,6 +384,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: false
@@ -407,6 +412,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
final selectedIdentity = Identity(id: IdentityId(Id('alice')));
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
@@ -421,6 +427,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -451,6 +458,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
when(mockMailboxDashBoardController.composerArguments).thenReturn(
ComposerArguments(identities: [identity]));
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
@@ -461,6 +469,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: false
@@ -491,6 +500,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
final selectedIdentity = Identity(
@@ -508,6 +518,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -538,6 +549,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
final identity = Identity(
@@ -555,6 +567,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: false
@@ -594,6 +607,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
final selectedIdentity = Identity(id: IdentityId(Id('alice')));
@@ -612,6 +626,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -665,6 +680,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
final selectedIdentity = Identity(id: IdentityId(Id('alice')));
@@ -683,6 +699,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -735,6 +752,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
composerController?.identitySelected.value = identity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
@@ -748,6 +766,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: alwaysReadReceiptEnabled
@@ -776,6 +795,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
composerController?.identitySelected.value = identity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
@@ -787,6 +807,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: false
@@ -823,6 +844,7 @@ void main() {
to: {toRecipient},
cc: {ccRecipient},
bcc: {bccRecipient},
replyTo: {replyToRecipient},
mailboxContain: PresentationMailbox(
MailboxId(Id('some-mailbox-id')),
role: PresentationMailbox.roleJunk)),
@@ -837,6 +859,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -876,6 +899,7 @@ void main() {
to: {toRecipient},
cc: {ccRecipient},
bcc: {bccRecipient},
replyTo: {replyToRecipient},
mailboxContain: PresentationMailbox(
MailboxId(Id('some-mailbox-id')),
role: PresentationMailbox.roleJunk)),
@@ -889,6 +913,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: false
@@ -930,6 +955,7 @@ void main() {
to: {toRecipient},
cc: {ccRecipient},
bcc: {bccRecipient},
replyTo: {replyToRecipient},
mailboxContain: PresentationMailbox(
MailboxId(Id('some-mailbox-id')),
role: PresentationMailbox.roleJunk)),
@@ -946,6 +972,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -987,6 +1014,7 @@ void main() {
to: {toRecipient},
cc: {ccRecipient},
bcc: {bccRecipient},
replyTo: {replyToRecipient},
mailboxContain: PresentationMailbox(
MailboxId(Id('some-mailbox-id')),
role: PresentationMailbox.roleJunk)),));
@@ -1002,6 +1030,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: false
@@ -1041,6 +1070,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
final selectedIdentity = Identity(id: IdentityId(Id('alice')));
composerController?.identitySelected.value = selectedIdentity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
@@ -1060,6 +1090,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -1113,6 +1144,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
final selectedIdentity = Identity(id: IdentityId(Id('alice')));
composerController?.identitySelected.value = selectedIdentity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
@@ -1132,6 +1164,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: selectedIdentity,
attachments: [attachment],
hasReadReceipt: false
@@ -1178,6 +1211,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
composerController?.hasRequestReadReceipt.value = alwaysReadReceiptEnabled;
const idenityId = 'some-identity-id';
@@ -1198,6 +1232,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: alwaysReadReceiptEnabled
@@ -1227,6 +1262,7 @@ void main() {
composerController?.listToEmailAddress = [toRecipient];
composerController?.listCcEmailAddress = [ccRecipient];
composerController?.listBccEmailAddress = [bccRecipient];
composerController?.listReplyToEmailAddress = [replyToRecipient];
composerController?.identitySelected.value = identity;
when(mockUploadController.attachmentsUploaded).thenReturn([attachment]);
composerController?.hasRequestReadReceipt.value = alwaysReadReceiptEnabled;
@@ -1237,6 +1273,7 @@ void main() {
toRecipients: {toRecipient},
ccRecipients: {ccRecipient},
bccRecipients: {bccRecipient},
replyToRecipients: {replyToRecipient},
identity: identity,
attachments: [attachment],
hasReadReceipt: alwaysReadReceiptEnabled
@@ -19,6 +19,7 @@ void main() {
toRecipients: {},
ccRecipients: {},
bccRecipients: {},
replyToRecipients: {},
);
group('create email request extension test:', () {
@@ -16,6 +16,7 @@ void main() {
toRecipients: {EmailAddress('to name', 'to email')},
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
replyToRecipients: {EmailAddress('replyTo name', 'replyTo email')},
identity: null,
attachments: [],
hasReadReceipt: false
@@ -37,7 +38,7 @@ void main() {
// arrange
const subject = 'subject';
const content = 'content';
final recipent = EmailAddress('recipent name', 'recipent email');
final recipient = EmailAddress('recipient name', 'recipient email');
final identity = Identity();
final attachments = <Attachment>[];
const hasReadReceipt = false;
@@ -45,9 +46,10 @@ void main() {
final toSavedEmailDraft = SavedEmailDraft(
subject: subject,
content: content,
toRecipients: {recipent},
toRecipients: {recipient},
ccRecipients: {},
bccRecipients: {},
replyToRecipients: {},
identity: identity,
attachments: attachments,
hasReadReceipt: hasReadReceipt
@@ -57,8 +59,9 @@ void main() {
subject: subject,
content: content,
toRecipients: {},
ccRecipients: {recipent},
ccRecipients: {recipient},
bccRecipients: {},
replyToRecipients: {},
identity: identity,
attachments: attachments,
hasReadReceipt: hasReadReceipt
@@ -69,21 +72,36 @@ void main() {
content: content,
toRecipients: {},
ccRecipients: {},
bccRecipients: {recipent},
bccRecipients: {recipient},
replyToRecipients: {},
identity: identity,
attachments: attachments,
hasReadReceipt: hasReadReceipt
);
final replyToSavedEmailDraft = SavedEmailDraft(
subject: subject,
content: content,
toRecipients: {},
ccRecipients: {},
bccRecipients: {},
replyToRecipients: {recipient},
identity: identity,
attachments: attachments,
hasReadReceipt: hasReadReceipt
);
// act
final toProps = toSavedEmailDraft.props;
final ccProps = ccSavedEmailDraft.props;
final bccProps = bccSavedEmailDraft.props;
final replyToProps = replyToSavedEmailDraft.props;
// assert
expect(toProps.hashCode, isNot(ccProps.hashCode));
expect(ccProps.hashCode, isNot(bccProps.hashCode));
expect(bccProps.hashCode, isNot(toProps.hashCode));
expect(bccProps.hashCode, isNot(replyToProps.hashCode));
expect(replyToProps.hashCode, isNot(toProps.hashCode));
});
test(
@@ -100,6 +118,7 @@ void main() {
toRecipients: listToRecipients,
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
replyToRecipients: {EmailAddress('replyTo name', 'replyTo email')},
identity: null,
attachments: [],
hasReadReceipt: false
@@ -125,6 +144,7 @@ void main() {
toRecipients: {EmailAddress('to name', 'to email')},
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
replyToRecipients: {EmailAddress('replyTo name', 'replyTo email')},
identity: null,
attachments: [],
hasReadReceipt: false
@@ -136,6 +156,7 @@ void main() {
toRecipients: {EmailAddress('to name', 'to email')},
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
replyToRecipients: {EmailAddress('replyTo name', 'replyTo email')},
identity: null,
attachments: [],
hasReadReceipt: false
@@ -16,8 +16,8 @@ void main() {
final replyToEmailAddress = EmailAddress('Reply To', 'replyToThis@domain.com');
final replyToListEmailAddress = EmailAddress(null, 'replyToList@domain.com');
group('GIVEN user A is the sender AND send an email to user B and user E, cc to user C, bcc to user D', () {
test('THEN user A click reply, generateRecipientsEmailAddressForComposer SHOULD return user B email + user E email to reply', () {
group('GIVEN user A is the sender AND sends an email to user B and user E, cc to user C, bcc to user D', () {
test('THEN user A clicks reply, generateRecipientsEmailAddressForComposer SHOULD return user B email + user E email to reply', () {
final expectedResult = Tuple3([userBEmailAddress, userEEmailAddress], <EmailAddress>[], <EmailAddress>[]);
final emailToReply = PresentationEmail(
@@ -38,7 +38,7 @@ void main() {
expect(result.value3, containsAll(expectedResult.value3));
});
test('THEN user A click reply all, generateRecipientsEmailAddressForComposer SHOULD return user B email + user E email to reply, user C email address to cc, user D email address to bcc', () {
test('THEN user A clicks reply all, generateRecipientsEmailAddressForComposer SHOULD return user B email + user E email to reply, user C email address to cc, user D email address to bcc', () {
final expectedResult = Tuple3([userBEmailAddress, userEEmailAddress], <EmailAddress>[userCEmailAddress], <EmailAddress>[userDEmailAddress]);
final emailToReply = PresentationEmail(
@@ -82,7 +82,7 @@ void main() {
expect(result.value3, containsAll(expectedResult.value3));
});
test('THEN user A click reply all, generateRecipientsEmailAddressForComposer SHOULD return replyToEmailAddress + user A email + user E email to reply, user C email address to cc, user D email address to bcc', () {
test('THEN user A clicks reply all, generateRecipientsEmailAddressForComposer SHOULD return replyToEmailAddress + user A email + user E email to reply, user C email address to cc, user D email address to bcc', () {
final expectedResult = Tuple3([userAEmailAddress, userEEmailAddress, replyToEmailAddress], <EmailAddress>[userCEmailAddress], <EmailAddress>[userDEmailAddress]);
final emailToReply = PresentationEmail(
@@ -104,8 +104,8 @@ void main() {
});
});
group('GIVEN user B is the sender, SENDER does not have the replyTo email AND send an email to user A and user E, cc to user C, bcc to user D', () {
test('THEN user A click reply, generateRecipientsEmailAddressForComposer SHOULD return only user B email to reply', () {
group('GIVEN user B is the sender, SENDER does not have the replyTo email AND sends an email to user A and user E, cc to user C, bcc to user D', () {
test('THEN user A clicks reply, generateRecipientsEmailAddressForComposer SHOULD return only user B email to reply', () {
final expectedResult = Tuple3([userBEmailAddress], <EmailAddress>[], <EmailAddress>[]);
final emailToReply = PresentationEmail(
@@ -125,7 +125,7 @@ void main() {
expect(result.value3, containsAll(expectedResult.value3));
});
test('THEN user A click reply all, generateRecipientsEmailAddressForComposer SHOULD return user A email + user E email + user B email to reply, user C email to cc, user D email to bcc', () {
test('THEN user A clicks reply all, generateRecipientsEmailAddressForComposer SHOULD return user A email + user E email + user B email to reply, user C email to cc, user D email to bcc', () {
final expectedResult = Tuple3([userAEmailAddress, userEEmailAddress, userBEmailAddress], <EmailAddress>[userCEmailAddress], <EmailAddress>[userDEmailAddress]);
final emailToReply = PresentationEmail(
@@ -171,7 +171,7 @@ void main() {
});
});
group('Given user A is the sender AND send an email to user B + user E, cc to user C, bcc to user D THEN user B click forward', () {
group('Given user A is the sender AND sends an email to user B + user E, cc to user C, bcc to user D THEN user B clicks forward', () {
test('generateRecipientsEmailAddressForComposer SHOULD return user user B email + user E email to reply, user C email to cc, user D email to bcc', () {
final expectedResult = Tuple3([userBEmailAddress, userEEmailAddress], <EmailAddress>[userCEmailAddress], <EmailAddress>[userDEmailAddress]);