Skip to content

Commit db32f1d

Browse files
committed
fix: Fix incorrect tag for MDN sent and hide junk flag used by Thunderbird
Signed-off-by: David Dreschner <[email protected]>
1 parent 1003f6c commit db32f1d

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

lib/Controller/MessagesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public function mdn(int $id): JSONResponse {
472472

473473
try {
474474
$this->mailTransmission->sendMdn($account, $mailbox, $message);
475-
$this->mailManager->flagMessage($account, $mailbox->getName(), $message->getUid(), 'mdnsent', true);
475+
$this->mailManager->flagMessage($account, $mailbox->getName(), $message->getUid(), '$mdnsent', true);
476476
} catch (ServiceException $ex) {
477477
$this->logger->error('Sending mdn failed: ' . $ex->getMessage());
478478
throw $ex;

lib/Db/Message.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ class Message extends Entity implements JsonSerializable {
8383
'seen',
8484
'forwarded',
8585
'$junk',
86+
'junk',
8687
'$notjunk',
88+
'notjunk',
8789
'$phishing',
88-
'mdnsent',
90+
'$mdnsent',
8991
Tag::LABEL_IMPORTANT,
9092
'$important' // @todo remove this when we have removed all references on IMAP to $important @link https://github.com/nextcloud/mail/issues/25
9193
];
@@ -287,6 +289,8 @@ public function setFlag(string $flag, bool $value = true) {
287289
$this->setFlagJunk($value);
288290
} elseif ($flag === '$notjunk') {
289291
$this->setFlagNotjunk($value);
292+
} elseif ($flag === '$mdnsent') {
293+
$this->setFlagMdnsent($value);
290294
} else {
291295
$this->setter(
292296
$this->columnToProperty("flag_$flag"),
@@ -339,7 +343,7 @@ public function jsonSerialize() {
339343
'important' => ($this->getFlagImportant() === true),
340344
'$junk' => ($this->getFlagJunk() === true),
341345
'$notjunk' => ($this->getFlagNotjunk() === true),
342-
'mdnsent' => ($this->getFlagMdnsent() === true),
346+
'$mdnsent' => ($this->getFlagMdnsent() === true),
343347
],
344348
'tags' => $indexed,
345349
'from' => $this->getFrom()->jsonSerialize(),

lib/Model/IMAPMessage.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function getFlags(): array {
162162
'draft' => in_array(Horde_Imap_Client::FLAG_DRAFT, $this->flags),
163163
'forwarded' => in_array(Horde_Imap_Client::FLAG_FORWARDED, $this->flags),
164164
'hasAttachments' => $this->hasAttachments,
165-
'mdnsent' => in_array(Horde_Imap_Client::FLAG_MDNSENT, $this->flags, true),
165+
'$mdnsent' => in_array(Horde_Imap_Client::FLAG_MDNSENT, $this->flags, true),
166166
'important' => in_array(Tag::LABEL_IMPORTANT, $this->flags, true)
167167
];
168168
}
@@ -535,8 +535,11 @@ public function toDbMessage(int $mailboxId, MailAccount $account): Message {
535535
$msg->setFlagJunk(
536536
in_array(Horde_Imap_Client::FLAG_JUNK, $flags, true)
537537
|| in_array('junk', $flags, true)
538-
);
539-
$msg->setFlagNotjunk(in_array(Horde_Imap_Client::FLAG_NOTJUNK, $flags, true) || in_array('nonjunk', $flags, true));// While this is not a standard IMAP Flag, Thunderbird uses it to mark "not junk"
538+
); // While this is not a standard IMAP Flag, Thunderbird uses it to mark "junk"
539+
$msg->setFlagNotjunk(
540+
in_array(Horde_Imap_Client::FLAG_NOTJUNK, $flags, true)
541+
|| in_array('nonjunk', $flags, true)
542+
); // While this is not a standard IMAP Flag, Thunderbird uses it to mark "not junk"
540543
$msg->setFlagImportant(in_array('$important', $flags, true) || in_array('$labelimportant', $flags, true) || in_array(Tag::LABEL_IMPORTANT, $flags, true));
541544
$msg->setFlagAttachments(false);
542545
$msg->setFlagMdnsent(in_array(Horde_Imap_Client::FLAG_MDNSENT, $flags, true));
@@ -551,6 +554,7 @@ public function toDbMessage(int $mailboxId, MailAccount $account): Message {
551554
Horde_Imap_Client::FLAG_DELETED,
552555
Horde_Imap_Client::FLAG_DRAFT,
553556
Horde_Imap_Client::FLAG_JUNK,
557+
'junk', // While this is not a standard IMAP Flag, Thunderbird uses it to mark "junk"
554558
Horde_Imap_Client::FLAG_NOTJUNK,
555559
'nonjunk', // While this is not a standard IMAP Flag, Thunderbird uses it to mark "not junk"
556560
'$phishing', // Horde has no const for this flag yet

src/components/MdnRequest.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default {
5151
computed: {
5252
...mapStores(useMainStore),
5353
mdnSent() {
54-
return this.message.flags.mdnsent
54+
return this.message.flags.$mdnsent
5555
},
5656
},
5757
@@ -62,7 +62,7 @@ export default {
6262
6363
try {
6464
await sendMdn(this.message.databaseId)
65-
this.mainStore.flagEnvelopeMutation({ envelope: this.message, flag: 'mdnsent', value: true })
65+
this.mainStore.flagEnvelopeMutation({ envelope: this.message, flag: '$mdnsent', value: true })
6666
} catch (error) {
6767
logger.error('could not send mdn', error)
6868
showError(t('mail', 'Could not send mdn'))

0 commit comments

Comments
 (0)