fix: Email content disappears after marking as star/unstar when thread is disabled
This commit is contained in:
@@ -228,6 +228,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
|
|
||||||
GlobalObjectKey? get htmlViewKey => _threadDetailController?.expandedEmailHtmlViewKey;
|
GlobalObjectKey? get htmlViewKey => _threadDetailController?.expandedEmailHtmlViewKey;
|
||||||
|
|
||||||
|
bool get isThreadDetailEnabled =>
|
||||||
|
_threadDetailController?.isThreadDetailEnabled == true;
|
||||||
|
|
||||||
SingleEmailController(
|
SingleEmailController(
|
||||||
this._getEmailContentInteractor,
|
this._getEmailContentInteractor,
|
||||||
this._markAsEmailReadInteractor,
|
this._markAsEmailReadInteractor,
|
||||||
@@ -1343,32 +1346,28 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void markAsStarEmail(
|
|
||||||
PresentationEmail presentationEmail,
|
|
||||||
MarkStarAction markStarAction,
|
|
||||||
) {
|
|
||||||
if (accountId != null && session != null) {
|
|
||||||
consumeState(_markAsStarEmailInteractor.execute(
|
|
||||||
session!,
|
|
||||||
accountId!,
|
|
||||||
presentationEmail.id!,
|
|
||||||
markStarAction,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _markAsEmailStarSuccess(MarkAsStarEmailSuccess success) {
|
void _markAsEmailStarSuccess(MarkAsStarEmailSuccess success) {
|
||||||
final newEmail = currentEmail?.updateKeywords({
|
final newKeywords = {
|
||||||
KeyWordIdentifier.emailFlagged: success.markStarAction == MarkStarAction.markStar,
|
KeyWordIdentifier.emailFlagged:
|
||||||
});
|
success.markStarAction == MarkStarAction.markStar,
|
||||||
|
};
|
||||||
|
|
||||||
|
final newEmail = currentEmail?.updateKeywords(newKeywords);
|
||||||
final emailId = newEmail?.id;
|
final emailId = newEmail?.id;
|
||||||
if (emailId == null) return;
|
if (emailId == null) return;
|
||||||
_threadDetailController?.emailIdsPresentation[emailId] = newEmail;
|
|
||||||
|
if (PlatformInfo.isMobile && !isThreadDetailEnabled) {
|
||||||
|
mailboxDashBoardController.selectedEmail.value?.resyncKeywords(newKeywords);
|
||||||
|
} else {
|
||||||
|
_threadDetailController?.emailIdsPresentation[emailId] = newEmail;
|
||||||
|
}
|
||||||
|
|
||||||
mailboxDashBoardController.updateEmailFlagByEmailIds(
|
mailboxDashBoardController.updateEmailFlagByEmailIds(
|
||||||
[emailId],
|
[emailId],
|
||||||
markStarAction: success.markStarAction,
|
markStarAction: success.markStarAction,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
toastManager.showMessageSuccess(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleEmailAction(BuildContext context, PresentationEmail presentationEmail, EmailActionType actionType) {
|
void handleEmailAction(BuildContext context, PresentationEmail presentationEmail, EmailActionType actionType) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2025-10-14T15:18:48.964794",
|
"@@last_modified": "2025-10-17T09:52:08.303266",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -4925,5 +4925,17 @@
|
|||||||
"placeholders": {
|
"placeholders": {
|
||||||
"count": {}
|
"count": {}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"mailHasBeenStarred": "Mail has been starred",
|
||||||
|
"@mailHasBeenStarred": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"mailHasBeenUnstarred": "Mail has been unstarred",
|
||||||
|
"@mailHasBeenUnstarred": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5198,4 +5198,18 @@ class AppLocalizations {
|
|||||||
args: [count],
|
args: [count],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get mailHasBeenStarred {
|
||||||
|
return Intl.message(
|
||||||
|
'Mail has been starred',
|
||||||
|
name: 'mailHasBeenStarred',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get mailHasBeenUnstarred {
|
||||||
|
return Intl.message(
|
||||||
|
'Mail has been unstarred',
|
||||||
|
name: 'mailHasBeenUnstarred',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,13 @@ import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.da
|
|||||||
import 'package:jmap_dart_client/jmap/core/error/method/exception/error_method_response_exception.dart';
|
import 'package:jmap_dart_client/jmap/core/error/method/exception/error_method_response_exception.dart';
|
||||||
import 'package:jmap_dart_client/jmap/core/error/set_error.dart';
|
import 'package:jmap_dart_client/jmap/core/error/set_error.dart';
|
||||||
import 'package:model/email/email_action_type.dart';
|
import 'package:model/email/email_action_type.dart';
|
||||||
|
import 'package:model/email/mark_star_action.dart';
|
||||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.dart';
|
import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/exceptions/calendar_event_exceptions.dart';
|
import 'package:tmail_ui_user/features/email/domain/exceptions/calendar_event_exceptions.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/model/move_action.dart';
|
import 'package:tmail_ui_user/features/email/domain/model/move_action.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
|
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/domain/state/mark_as_email_star_state.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/state/parse_email_by_blob_id_state.dart';
|
import 'package:tmail_ui_user/features/email/domain/state/parse_email_by_blob_id_state.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/state/preview_email_from_eml_file_state.dart';
|
import 'package:tmail_ui_user/features/email/domain/state/preview_email_from_eml_file_state.dart';
|
||||||
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
|
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
|
||||||
@@ -244,6 +246,10 @@ class ToastManager {
|
|||||||
} else {
|
} else {
|
||||||
message = appLocalizations.you_are_changed_your_identity_successfully;
|
message = appLocalizations.you_are_changed_your_identity_successfully;
|
||||||
}
|
}
|
||||||
|
} else if (success is MarkAsStarEmailSuccess) {
|
||||||
|
message = success.markStarAction == MarkStarAction.markStar
|
||||||
|
? appLocalizations.mailHasBeenStarred
|
||||||
|
: appLocalizations.mailHasBeenUnstarred;
|
||||||
}
|
}
|
||||||
log('ToastManager::showMessageSuccess: Message: $message');
|
log('ToastManager::showMessageSuccess: Message: $message');
|
||||||
if (message?.trim().isNotEmpty == true) {
|
if (message?.trim().isNotEmpty == true) {
|
||||||
|
|||||||
@@ -202,4 +202,9 @@ extension PresentationEmailExtension on PresentationEmail {
|
|||||||
|
|
||||||
MailboxId? get firstMailboxIdAvailable =>
|
MailboxId? get firstMailboxIdAvailable =>
|
||||||
mailboxIds?.entries.firstWhereOrNull((element) => element.value)?.key;
|
mailboxIds?.entries.firstWhereOrNull((element) => element.value)?.key;
|
||||||
|
|
||||||
|
void resyncKeywords(Map<KeyWordIdentifier, bool> newKeywords) {
|
||||||
|
keywords?.addAll(newKeywords);
|
||||||
|
keywords?.removeWhere((key, value) => !value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user