Closed Bug 1912584 Opened 3 months ago Closed 4 days ago

folders.query can return folders from unsupported accounts (e.g. rss)

Categories

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

defect

Tracking

(thunderbird_esr128 affected)

RESOLVED DUPLICATE of bug 1912393
Tracking Status
thunderbird_esr128 --- affected

People

(Reporter: Fallen, Assigned: TbSync)

Details

Attachments

(1 obsolete file)

messenger.accounts.list() returns a list of accounts and filters heavily on which types are supported. RSS for example is not supported at the moment.

messenger.folders.query({ recent: true, limit: 15 , canAddMessages: true }) will however happily return RSS folders. They have an accountId which is not returned by messenger.accounts.list.

Side note, canAddMessages has no effect in combination with recent: true, as the filtering occurs before. Let me know if you prefer a separate bug for this.

We changed the account API code for 128 to only return "known" types, and skip others, allowing us to use an enum for the type def, which improves documentation and expectations.

Since I was not aware that we did support rss and owl accounts in the past, these two were dropped. They are being returned here:

Can I close this as Dupe of 1912393?

1912393 could need a review :-)

That would solve rss, but the bug would still occur for other folder types that we don't support in the API, but could feasibly be "recent" folders. What you likely need to do is apply the types filter (and various other folders.query filters like canAddMessages) after https://searchfox.org/comm-central/rev/41a8982a48c4f4a921989b6ed7f17acf82d4523f/mail/components/extensions/parent/ext-folders.js#886

Assignee: nobody → john
Status: NEW → ASSIGNED
Attachment #9427167 - Attachment description: Bug 1912584 - No longer return unfiltered most recent folders. r=Fallen → Bug 1912584 - No longer return unfiltered most recent folders. r=Fallen

@Fallen: Are the proposed changes what you had in mind?

Depends on: 1928926
Attachment #9427167 - Attachment is obsolete: true

The issue is indeed fixed by the two bugs listed in Comment #1. The parentFolders Array, which is the base definition of which folders are to be searched and returned, can no longer include accounts or folders which are not supported by the API.

While working on this, I did see that the getMostRecentFolders() function does not return a sorted folder list in some occasions, which is covered in Bug 1928926.

There is one possible optimization: Instead of calling getMostRecentFolders() on the final list of found folders, we could limit each parentFolder to its recent subfolders. This would skip folders in the query check, which can never be part of the result. This is evaluated in Bug 1928953.

Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Duplicate of bug: 1912393
Resolution: --- → DUPLICATE
No longer depends on: 1928926
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: