Closed Bug 1610457 Opened 5 years ago Closed 5 years ago

"Junk" status of a message is hidden from Add-Ons

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 74.0

People

(Reporter: martin, Assigned: darktrojan)

Details

Attachments

(1 file, 1 obsolete file)

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

Steps to reproduce:

I wrote an Add-On which searches for messages marked as "junk" by using "browser.messages.list(...)" to get a list of all messages in a folder and then the "junk" tag in the "page.messages[n].tags[]" array for a tag named "junk".

Actual results:

In Thunderbird 68.4.1, the "page.messages[n].tags[]" array is empty for ALL messages.
This has the effect that ALL messages are detected as "NOT marked as junk" by the Add-On. Therefore the Add-On does not work correctly.

Expected results:

In an older Thunderbird 68.x version (I don't remember which version in the range 68.0-68.4.0), the "page.messages[n].tags[]" array contained a tag "junk" if the message was marked as "junk". This allowed the Add-On to detect messages that are marked as "junk".

Component: Untriaged → Add-Ons: General
OS: Unspecified → All
Hardware: Unspecified → x86_64

I found out the change that causes the problem:

In file "chrome/messenger/content/messenger/parent/ext-mail.js", function "convertMessage()", line 1354 has been inserted:

messageObject.tags = tags.filter(MailServices.tags.isValidKey);

This line will remove the tag "junk" from the array tags[] before writing it to messageObject.tags.

I don't know if this effect is desired. If yes, an additional property should be added to messageObject that allows checking an add-on if a message is marked as junk or not.

Example: messageObject.isJunk = ...

However, this change would require all add-ons that check the junk status of messages to be re-written.

That add-ons could see the junk status in this way was unintended. I will add a junk property to the message object as that is a useful thing to know, and it can already be set and removed.

Assignee: nobody → geoff
Status: UNCONFIRMED → ASSIGNED
Component: Add-Ons: General → Add-Ons: Extensions API
Ever confirmed: true
Hardware: x86_64 → All
Attached patch 1610457-messages-junk-1.diff (obsolete) — Splinter Review
Attachment #9122285 - Flags: review?(mkmelin+mozilla)
Attachment #9122285 - Flags: approval-comm-esr68?
Attachment #9122285 - Flags: approval-comm-beta?
Comment on attachment 9122285 [details] [diff] [review] 1610457-messages-junk-1.diff Review of attachment 9122285 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. Maybe we should also expose a junkScore, which some add-ons may want to do stuff with.
Attachment #9122285 - Flags: review?(mkmelin+mozilla) → review+

AFAICT, junkScore is either 0 or 100. Which seems a bit weird to me.

(In reply to Geoff Lankow (:darktrojan) from comment #5)

AFAICT, junkScore is either 0 or 100. Which seems a bit weird to me.

I'm sure there's some history behind that. Not sure who'd remember.

Would have to dig deeper to verify but I think 0 and 100 are the ones you get if you set something to ham or spam. For classification in general, all it takes to make it spam is that it's above mail.adaptivefilters.junk_threshold (90 by default).

Let's not check this in then. I'll come back to it.

I have been in the process of moving an addon to the new api (with no XUL)...... I have been real happy with the progress.

and then got stuck at no junkScore or junk status being available in the api. I could work with either, but was using junkscore in the past.

Now with junk score.

Attachment #9122285 - Attachment is obsolete: true
Attachment #9122285 - Flags: approval-comm-esr68?
Attachment #9122285 - Flags: approval-comm-beta?
Attachment #9123228 - Flags: review?(mkmelin+mozilla)
Attachment #9123228 - Flags: review?(mkmelin+mozilla) → review+

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/66070529eac2
Add junk and junkScore properties to message objects that are returned from APIs. r=mkmelin DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 74.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: