Adding functionality for mails to be unread when moved to spam.
Rebasing (cherry picked from commit 4a907520bc0b53ff42cb7d6cde40771a649629f5)
This commit is contained in:
@@ -30,10 +30,10 @@ extension ListEmailIdExtension on List<EmailId> {
|
||||
};
|
||||
}
|
||||
|
||||
Map<Id, PatchObject> generateMapUpdateObjectMarkAsSpam(MailboxId spamMailboxId) {
|
||||
Map<Id, PatchObject> generateMapUpdateObjectMoveToSpam(MailboxId currentMailboxId, MailboxId spamMailboxId) {
|
||||
return {
|
||||
for (var emailId in this)
|
||||
emailId.id: spamMailboxId.generateActionPath()
|
||||
emailId.id: currentMailboxId.generateMoveToSpamActionPath(currentMailboxId, spamMailboxId)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:jmap_dart_client/jmap/core/patch_object.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/reference_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/keyword_identifier.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:model/extensions/keyword_identifier_extension.dart';
|
||||
|
||||
extension MailboxIdExtension on MailboxId {
|
||||
String generatePath() {
|
||||
@@ -24,5 +26,13 @@ extension MailboxIdExtension on MailboxId {
|
||||
});
|
||||
}
|
||||
|
||||
PatchObject generateMoveToSpamActionPath(MailboxId currentMailboxId, MailboxId spamMailboxId) {
|
||||
return PatchObject({
|
||||
currentMailboxId.generatePath(): null,
|
||||
spamMailboxId.generatePath(): true,
|
||||
KeyWordIdentifier.emailSeen.generatePath(): true
|
||||
});
|
||||
}
|
||||
|
||||
String get asString => id.value;
|
||||
}
|
||||
Reference in New Issue
Block a user