From 55fd880224303bb77ecf4afaa589f3a296c8a357 Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 17 Nov 2022 14:24:29 +0700 Subject: [PATCH] TF-1180 Fix read receipt wrong content --- .../controller/single_email_controller.dart | 11 ++++++----- lib/l10n/intl_messages.arb | 8 ++++---- lib/main/localizations/app_localizations.dart | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/features/email/presentation/controller/single_email_controller.dart b/lib/features/email/presentation/controller/single_email_controller.dart index d1c743b79..bd578c3d8 100644 --- a/lib/features/email/presentation/controller/single_email_controller.dart +++ b/lib/features/email/presentation/controller/single_email_controller.dart @@ -893,7 +893,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin { void _handleSendReceiptToSenderAction(BuildContext context) { final accountId = mailboxDashBoardController.accountId.value; - if (accountId == null) { + final userProfile = mailboxDashBoardController.userProfile.value; + if (accountId == null || userProfile == null) { return; } @@ -948,7 +949,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin { return; } - final mdnToSender = _generateMDN(context, currentEmail!); + final mdnToSender = _generateMDN(context, currentEmail!, userProfile); final sendReceiptRequest = SendReceiptToSenderRequest( mdn: mdnToSender, identityId: _identitySelected!.id!, @@ -958,8 +959,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin { consumeState(_sendReceiptToSenderInteractor!.execute(accountId, sendReceiptRequest)); } - MDN _generateMDN(BuildContext context, PresentationEmail email) { - final senderEmailAddress = email.from?.first.asFullString() ?? ''; + MDN _generateMDN(BuildContext context, PresentationEmail email, UserProfile userProfile) { + final receiverEmailAddress = userProfile.email; final subjectEmail = email.subject ?? ''; final timeCurrent = DateTime.now(); final timeAsString = '${timeCurrent.formatDate( @@ -969,7 +970,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin { forEmailId: email.id, subject: AppLocalizations.of(context).subjectSendReceiptToSender(subjectEmail), textBody: AppLocalizations.of(context).textBodySendReceiptToSender( - senderEmailAddress, + receiverEmailAddress, subjectEmail, timeAsString), disposition: Disposition( diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index 2b68365d8..2c50f3212 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2022-11-14T16:25:49.764077", + "@@last_modified": "2022-11-17T14:21:04.763049", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -2348,16 +2348,16 @@ "subject": {} } }, - "textBodySendReceiptToSender": "Message was read by {sender} on {time} \n\nSubject: {subject} \n\nNote: This Return ReceiptReceipt only acknowledges that the message was displayed on the recipient's computer. There is no guarantee that the recipient has read or understood the message contents.", + "textBodySendReceiptToSender": "Message was read by {receiver} on {time} \n\nSubject: {subject} \n\nNote: This Return Read Receipt only acknowledges that the message was displayed on the recipient's computer. There is no guarantee that the recipient has read or understood the message contents.", "@textBodySendReceiptToSender": { "type": "text", "placeholders_order": [ - "sender", + "receiver", "subject", "time" ], "placeholders": { - "sender": {}, + "receiver": {}, "subject": {}, "time": {} } diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index 2437cc8dd..ec9413dad 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -2428,11 +2428,11 @@ class AppLocalizations { args: [subject]); } - String textBodySendReceiptToSender(String sender, String subject, String time) { + String textBodySendReceiptToSender(String receiver, String subject, String time) { return Intl.message( - 'Message was read by $sender on $time \n\nSubject: $subject \n\nNote: This Return ReceiptReceipt only acknowledges that the message was displayed on the recipient\'s computer. There is no guarantee that the recipient has read or understood the message contents.', + 'Message was read by $receiver on $time \n\nSubject: $subject \n\nNote: This Return Read Receipt only acknowledges that the message was displayed on the recipient\'s computer. There is no guarantee that the recipient has read or understood the message contents.', name: 'textBodySendReceiptToSender', - args: [sender, subject, time]); + args: [receiver, subject, time]); } String get toastMessageSendReceiptSuccess {