TF-4195 Fix comments of coderabbit

This commit is contained in:
dab246
2025-12-26 12:22:18 +07:00
committed by Dat H. Pham
parent 0076a7af57
commit e8b2c1d2a5
32 changed files with 235 additions and 146 deletions
@@ -4,27 +4,16 @@ import 'package:model/email/presentation_email.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/presentation_email_extension.dart';
extension PresentationEmailMapExtension on Map<EmailId, PresentationEmail?> {
Map<EmailId, PresentationEmail?> addEmailKeywordById({
Map<EmailId, PresentationEmail?> toggleEmailKeywordById({
required EmailId emailId,
required KeyWordIdentifier keyword,
required bool remove,
}) {
return map((id, email) {
if (id != emailId || email == null) {
return MapEntry(id, email);
}
return MapEntry(id, email.addKeyword(keyword));
});
}
Map<EmailId, PresentationEmail?> removeEmailKeywordById({
required EmailId emailId,
required KeyWordIdentifier keyword,
}) {
return map((id, email) {
if (id != emailId || email == null) {
return MapEntry(id, email);
}
return MapEntry(id, email.removeKeyword(keyword));
});
final newMap = Map<EmailId, PresentationEmail?>.from(this);
final email = newMap[emailId];
if (email != null) {
newMap[emailId] = email.toggleKeyword(keyword, remove);
}
return newMap;
}
}