TF-153 Combine moveToMailbox and moveToTrash to moveToMailbox using EmailActionType object
This commit is contained in:
@@ -8,11 +8,9 @@ import 'package:model/model.dart';
|
||||
|
||||
extension EmailExtension on Email {
|
||||
|
||||
bool isUnReadEmail() => !(keywords?.containsKey(KeyWordIdentifier.emailSeen) == true);
|
||||
bool get hasRead => keywords?.containsKey(KeyWordIdentifier.emailSeen) == true;
|
||||
|
||||
bool isReadEmail() => keywords?.containsKey(KeyWordIdentifier.emailSeen) == true;
|
||||
|
||||
bool isFlaggedEmail() => keywords?.containsKey(KeyWordIdentifier.emailFlagged) == true;
|
||||
bool get hasStarred => keywords?.containsKey(KeyWordIdentifier.emailFlagged) == true;
|
||||
|
||||
bool get withAttachments => hasAttachment == true;
|
||||
|
||||
|
||||
@@ -32,4 +32,12 @@ extension ListEmailIdExtension on List<EmailId> {
|
||||
});
|
||||
return maps;
|
||||
}
|
||||
|
||||
Map<Id, PatchObject> generateMapUpdateObjectMarkAsSpam(MailboxId spamMailboxId) {
|
||||
final Map<Id, PatchObject> maps = {};
|
||||
forEach((emailId) {
|
||||
maps[emailId.id] = spamMailboxId.generateActionPath();
|
||||
});
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
extension ListPresentationEmailExtension on List<PresentationEmail> {
|
||||
bool get isAllEmailRead => every((email) => email.isReadEmail());
|
||||
bool get isAllEmailRead => every((email) => email.hasRead);
|
||||
|
||||
bool get isAllEmailStarred => every((email) => email.isFlaggedEmail());
|
||||
bool get isAllEmailStarred => every((email) => email.hasStarred);
|
||||
|
||||
List<PresentationEmail> get allEmailUnread => where((email) => email.isUnReadEmail()).toList();
|
||||
List<PresentationEmail> get allEmailUnread => where((email) => !email.hasRead).toList();
|
||||
|
||||
PresentationEmail? findEmail(EmailId emailId) {
|
||||
try {
|
||||
|
||||
@@ -12,4 +12,10 @@ extension MailboxIdExtension on MailboxId {
|
||||
destinationMailboxId.generatePath(): true
|
||||
});
|
||||
}
|
||||
|
||||
PatchObject generateActionPath() {
|
||||
return PatchObject({
|
||||
generatePath(): true,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user