Closed Bug 1600547 Opened 5 years ago Closed 4 years ago

allow browser.messages.query to find messages with specified tags

Categories

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

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 74.0

People

(Reporter: mkmelin, Assigned: darktrojan)

Details

Attachments

(1 file, 2 obsolete files)

https://thunderbird-webextensions.readthedocs.io/en/68/messages.html#query-queryinfo

queryInfo doesn't allow a list tags as one of the options. We should allow querying by tags.

I was going to implement this with an array of tags that must all match, but I think it fits better to only allow querying one tag. Any further filtering can be done by the extension.

Assignee: nobody → geoff
Status: NEW → ASSIGNED
Attached patch 1600547-query-by-tag-1.diff (obsolete) — Splinter Review
Attachment #9118131 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9118131 [details] [diff] [review]
1600547-query-by-tag-1.diff

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

Tags are more complex, and I think we shouldn't limit it to one tag only.  The api should support many and also allow the combination have, have not.
Attachment #9118131 - Flags: review?(mkmelin+mozilla) → review-

Possibly for NOT, we should just interpret !foo as not foo.

in order to keep compatibility with current use, I opt to implement it as is done in gloda.query. There, for example, I can query for an array of tags as returned by the tag service.

use scenario: for mail servers not storing tags, have a query that returns all tagged emails together with their tags, headermessageIDs, folder info (e.g. folder and parent), so a list can be backed up in the file system and can be restored to the mailbox.

special important use scenario: on an imap server, repair folder actually kills tags. It should better be renamed redownload folder. Although the tags were there before repair, they are gone after repair (unless the imap server stores them, but that is not required by imap rfc)..

So unless I can backup/restore the tags, tags are gone after folder repair on certain imap servers.

Attached patch 1600547-query-by-tag-1.diff (obsolete) — Splinter Review

Allows for querying any number of tags matching any or all of the tags. Does not check for the non-existence of tags, because GloDa doesn't support that.

Attachment #9118131 - Attachment is obsolete: true
Attachment #9124897 - Flags: review?(mkmelin+mozilla)
Attachment #9124897 - Flags: review?(mkmelin+mozilla) → review+

why filter the collection and not let Gloda do the searching?

If I search only for tagged queries, the proposal would search in Gloda for an empty condition and throw an error. I think similiar was reported some time ago for read (?) status? I think there, Gloda didn't work on that status, as the bug (Geoff?) later reported.

But query.tags() works at least in TB 68.

At least for all tags, this works in 68:

let tagArray = MailServices.tags.getAllTags({});
query.tags(...tagArray);

Klaus

Perhaps it would help if I uploaded the current patch instead of the first one again. I'm surprised you didn't notice, Magnus.

Attachment #9124897 - Attachment is obsolete: true
Attachment #9125258 - Flags: review?(mkmelin+mozilla)
Attachment #9125258 - Flags: review?(mkmelin+mozilla) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/5c29bf6eb78b
Allow browser.messages.query to find messages with specified tag. r=mkmelin DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 74.0
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/c4ca8ba04d38
and bug 1611623 - fix linting errors. rs=linting DONTBUILD
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/fdfadf3060d1
follow-up - Remove stray properties from schema. rs=bustage-fix
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: