mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-05 16:08:46 +00:00
TF-5022 Check the shown account again when Open is tapped on the restored messages toast of MailboxDashBoardController
This commit is contained in:
1 parent
a842a68b75
commit
44cc4d6caf
2 files changed
+41
-1
No files matched your search
+5
-1
@@ -3269,7 +3269,11 @@ class MailboxDashBoardController extends ReloadableController
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).restoreDeletedMessageSuccess,
|
||||
actionName: AppLocalizations.of(currentContext!).open,
|
||||
onActionClick: () => openMailboxAction(success.recoveredMailbox!.toPresentationMailbox()),
|
||||
onActionClick: () {
|
||||
// Open may be tapped once another account is shown, where this folder does not exist.
|
||||
if (success.accountId != activeAccountId) return;
|
||||
openMailboxAction(success.recoveredMailbox!.toPresentationMailbox());
|
||||
},
|
||||
leadingSVGIcon: imagePaths.icRecoverDeletedMessages,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
|
||||
+36
@@ -540,6 +540,42 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
for (final switched in [false, true]) {
|
||||
testWidgets('Open on a restore finished on bob ${switched ? 'does nothing once carol is shown' : 'opens its folder'}',
|
||||
(tester) async {
|
||||
await pumpLocalizedApp(tester);
|
||||
clearInteractions(appToast);
|
||||
final source = ActiveAccountSourceFixtures.putShowing(DelegationFixtures.bobAccountId);
|
||||
mailboxDashboardController.mailboxUIAction.value = null;
|
||||
mailboxDashboardController.handleSuccessViewState(GetRestoredDeletedMessageCompleted(
|
||||
EmailRecoveryAction(id: EmailRecoveryActionId(Id('recovery-1'))),
|
||||
DelegationFixtures.bobAccountId,
|
||||
recoveredMailbox: Mailbox(id: MailboxId(Id('bob-restored'))),
|
||||
));
|
||||
final open = verify(appToast.showToastMessage(
|
||||
any,
|
||||
any,
|
||||
actionName: anyNamed('actionName'),
|
||||
onActionClick: captureAnyNamed('onActionClick'),
|
||||
actionIcon: anyNamed('actionIcon'),
|
||||
leadingSVGIcon: anyNamed('leadingSVGIcon'),
|
||||
leadingSVGIconColor: anyNamed('leadingSVGIconColor'),
|
||||
backgroundColor: anyNamed('backgroundColor'),
|
||||
textColor: anyNamed('textColor'),
|
||||
)).captured.single as Function;
|
||||
|
||||
if (switched) source.show(DelegationFixtures.carolAccountId);
|
||||
open();
|
||||
|
||||
final action = mailboxDashboardController.mailboxUIAction.value;
|
||||
if (switched) {
|
||||
expect(action, isNull);
|
||||
} else {
|
||||
expect((action as OpenMailboxAction).presentationMailbox.id, MailboxId(Id('bob-restored')));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test('keeps polling the account the restore started on while it is in progress', () {
|
||||
ActiveAccountSourceFixtures.putShowing(DelegationFixtures.carolAccountId);
|
||||
final recoveryAction = EmailRecoveryAction(id: EmailRecoveryActionId(Id('recovery-1')));
|
||||
|
||||
Reference in new issue
Block a user