TF-3294 Handle open email in Sent mailbox

This commit is contained in:
DatDang
2025-08-21 15:31:25 +07:00
committed by Dat H. Pham
parent e5e1771834
commit 22be6b4b0c
6 changed files with 37 additions and 11 deletions
@@ -2,8 +2,9 @@ import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:tmail_ui_user/features/thread_detail/domain/model/email_in_thread_detail_info.dart';
extension ListEmailInThreadDetailInfoExtension on List<EmailInThreadDetailInfo> {
List<EmailId> get emailIdsToDisplay =>
where((email) => email.isValidToDisplay)
List<EmailId> emailIdsToDisplay(bool isSentMailbox) => isSentMailbox
? map((email) => email.emailId).toList()
: where((email) => email.isValidToDisplay)
.map((email) => email.emailId)
.toList();
}
@@ -21,6 +21,7 @@ class GetThreadByIdInteractor {
AccountId accountId,
MailboxId sentMailboxId,
String ownEmailAddress, {
required bool isSentMailbox,
bool updateCurrentThreadDetail = false,
}) async* {
try {
@@ -36,7 +37,7 @@ class GetThreadByIdInteractor {
);
yield Right(GetThreadByIdSuccess(
result.emailIdsToDisplay,
result.emailIdsToDisplay(isSentMailbox),
threadId: threadId,
updateCurrentThreadDetail: updateCurrentThreadDetail,
emailsInThreadDetailInfo: result,
@@ -51,6 +52,8 @@ class GetThreadByIdInteractor {
accountId,
sentMailboxId,
ownEmailAddress,
isSentMailbox: isSentMailbox,
updateCurrentThreadDetail: updateCurrentThreadDetail,
),
updateCurrentThreadDetail: updateCurrentThreadDetail,
));