Skip to content

Commit

Permalink
TF-3385 Fix change flags not working
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Jan 3, 2025
1 parent fc0a3b7 commit c1ae133
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,13 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
KeyWordIdentifier.emailFlagged: success.markStarAction == MarkStarAction.markStar,
});
mailboxDashBoardController.setSelectedEmail(newEmail);

final emailId = newEmail?.id;
if (emailId == null) return;
mailboxDashBoardController.updateEmailFlagByEmailIds(
[emailId],
markStarAction: success.markStarAction,
);
}

void handleEmailAction(BuildContext context, PresentationEmail presentationEmail, EmailActionType actionType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:model/email/mark_star_action.dart';
import 'package:model/email/presentation_email.dart';
import 'package:model/email/read_actions.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/dashboard_routes.dart';

extension UpdateCurrentEmailsFlagsExtension on MailboxDashBoardController {
void updateEmailFlagByEmailIds(
Expand All @@ -13,7 +14,11 @@ extension UpdateCurrentEmailsFlagsExtension on MailboxDashBoardController {
}) {
if (readAction == null && markStarAction == null) return;

for (var email in emailsInCurrentMailbox) {
final currentEmails = dashboardRoute.value == DashboardRoutes.searchEmail
? listResultSearch
: emailsInCurrentMailbox;

for (var email in currentEmails) {
if (!emailIds.contains(email.id)) continue;

switch (readAction) {
Expand All @@ -39,7 +44,7 @@ extension UpdateCurrentEmailsFlagsExtension on MailboxDashBoardController {
}
}

emailsInCurrentMailbox.refresh();
currentEmails.refresh();
}

void _updateKeyword(
Expand Down

0 comments on commit c1ae133

Please sign in to comment.