Skip to content

Commit

Permalink
fixup! TF-3385 Fix loading forever when empty <20 items mailbox
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Jan 7, 2025
1 parent b338e4b commit b1c3bd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ extension MoveEmailsToMailboxExtension on MailboxDashBoardController {
final currentMailbox = selectedMailbox.value;
final currentTotalEmails = currentMailbox?.totalEmails;
if (currentMailbox != null && currentTotalEmails != null) {
final newTotalEmails = currentTotalEmails.value.value.toInt() - movedEmailIds.length;
int newTotalEmails = currentTotalEmails.value.value.toInt() - movedEmailIds.length;
if (newTotalEmails < 0) newTotalEmails = 0;
selectedMailbox.value = currentMailbox.copyWith(
totalEmails: TotalEmails(UnsignedInt(newTotalEmails)),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/features/thread/presentation/thread_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ class ThreadController extends BaseController with EmailActionController {
final currentMailbox = mailboxDashBoardController.selectedMailbox.value;
final currentTotalEmails = currentMailbox?.totalEmails;
if (currentMailbox != null && currentTotalEmails != null) {
final newTotalEmails = currentTotalEmails.value.value.toInt() - deletedEmailsCount;
int newTotalEmails = currentTotalEmails.value.value.toInt() - deletedEmailsCount;
if (newTotalEmails < 0) newTotalEmails = 0;
mailboxDashBoardController.selectedMailbox.value = currentMailbox.copyWith(
totalEmails: TotalEmails(UnsignedInt(newTotalEmails)),
);
Expand Down

0 comments on commit b1c3bd0

Please sign in to comment.