Closed Bug 1605915 Opened 4 years ago Closed 4 years ago

messages.update API does not really change message tags in IMAP folders

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect
Not set
normal

Tracking

(thunderbird_esr68 fixed)

RESOLVED FIXED
Thunderbird 73.0
Tracking Status
thunderbird_esr68 --- fixed

People

(Reporter: mevedech, Assigned: darktrojan)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

Thunderbird 68.3.0, Debian 9, Linux 4.9, x86_64
I have IMAP accounts and I am developing an extension (MailExtension, no legacy code) for Thunderbird. My extension should add a tag to messages in some cases.
In my extension code:
let ml = await browser.mailTabs.getSelectedMessages();
let mh = ml.messages[0]; // assume there is at least one message
let tags = mh.tags;
// ... checking if there is no our tag in 'tags' ...
tags.push('some valid tag'); //e.g. '$label3'
await browser.messages.update(mh.id, {'tags': tags});

Actual results:

The added tag has appeared in the Thunderbird interface: the message is colored properly and it can be filtered by that tag. But the message remains without my tag on the IMAP server side. So when I see that message next time (after I go to another folder or restart the program) it has not my tag. If I tag the message manually the tag is saved properly. It is reproduced with a public IMAP server and with my own IMAP server, so I think it is not a server bug.
The bug does not appear in local (not IMAP) folders.

Expected results:

The tag should be saved in IMAP server.

Can confirm. I think this is partly bug 1596371, but mainly naïve tag setting code in the API, which also destroys keywords that aren't tags. I'll fix that at the same time.

Assignee: nobody → geoff
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9118128 - Flags: review?(mkmelin+mozilla)
Attachment #9118128 - Flags: approval-comm-esr68?
Comment on attachment 9118128 [details] [diff] [review]
1605915-keywords-tags-1.diff

Review of attachment 9118128 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM, r=mkmelin
Attachment #9118128 - Flags: review?(mkmelin+mozilla) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/04f68cf65ac6
Prevent APIs interfering with non-tag keywords on messages; r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 73.0
Attachment #9118128 - Flags: approval-comm-esr68? → approval-comm-esr68+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: