Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2021-02-25 11:30:36 +0300
committerAnna Larch <anna@nextcloud.com>2021-02-26 16:45:01 +0300
commit4cc2dd73fdddabf9299ca91464023d7b706a1e41 (patch)
treeaea66411757fdf5519ce60c41a7717b5078a22e1 /lib/Listener
parent649d9b1f384cb088db508a95eeae21dc949617e4 (diff)
Save important flag to IMAP if permflags enabled
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/Listener')
-rw-r--r--lib/Listener/NewMessageClassificationListener.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Listener/NewMessageClassificationListener.php b/lib/Listener/NewMessageClassificationListener.php
index 365251883..56585730c 100644
--- a/lib/Listener/NewMessageClassificationListener.php
+++ b/lib/Listener/NewMessageClassificationListener.php
@@ -67,11 +67,16 @@ class NewMessageClassificationListener implements IEventListener {
}
}
+ // if the message is already flagged as important, we won't classify it again.
+ $messages = array_filter($event->getMessages(), function ($message) {
+ return ($message->getFlagImportant() === false);
+ });
+
try {
$predictions = $this->classifier->classifyImportance(
$event->getAccount(),
$event->getMailbox(),
- $event->getMessages()
+ $messages
);
foreach ($event->getMessages() as $message) {