Closed Bug 1911480 Opened 8 months ago Closed 6 months ago

messageDisplay..getDisplayedMessages() falsely returns gDBView.getSelectedMsgHdrs()

Categories

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

defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: buecher, Unassigned)

Details

docu is wrong or code is wrong.
This function returns the selected messages, not the displayed messages (tested in 115).

Instead of nativeTab.chromeBrowser.contentWindow.gDBView.getSelectedMsgHdrs();,

it should iterate from 0 to gDBView.numMsgInView and for each return gDBView.getMsgHdrAt(in nsMsgViewIndex aIndex);
This solution includes threaded, invisible messages

maybe the new mailTabs.getListedMessages does that already what the docu describes?

In any case, there is a need for both:

List all messages in the gDBView, even if hidden
List only displayed messages in the gDBView.

FYI:
I am not quite sure whether both functions do what is announced in the docu because of this in the idl: (including messages in collapsed threads)

/**

  • Number of messages in view, including messages in collapsed threads.
  • Not currently implemented for threads with unread or watched threads
  • with unread.
    */
    readonly attribute long numMsgsInView;

it should iterate from 0 to gDBView.numMsgInView and for each return gDBView.getMsgHdrAt(in nsMsgViewIndex aIndex);
This solution includes threaded, invisible messages

This is not doing what you described in Thunderbird 128. If there are 4 messages in the view, but one is collapsed in a thread, the following happens:

  • gTabmail.currentAbout3Pane.gDBView.numMsgInView is 4
  • gTabmail.currentAbout3Pane.gDBView.rowCount is 3
  • gTabmail.currentAbout3Pane.gDBView.getMsgHdrA(0) returns a message
  • gTabmail.currentAbout3Pane.gDBView.getMsgHdrA(1) returns a message
  • gTabmail.currentAbout3Pane.gDBView.getMsgHdrA(2) returns a message
  • gTabmail.currentAbout3Pane.gDBView.getMsgHdrA(3) fails, because getMsgHdrAt() works on actual indices of listed messages

If the thread is un-collapsed, rowCount is 4 and getMsgHdrA(3) returns a message. The correct loop-counterpart for getMsgHdrAt() is rowCount, and both ignore messages collapsed in threads.

This function returns the selected messages, not the displayed messages (tested in 115).

The messageDisplay API works with the actual message display, not with the threadPane. However, the messages which are "displayed" in the mail3pane window in the message browser are the messages which are selected in the threadpane.

The mailTabs API works with the threadpane, mailTabs.getListedMessages() returns the messages which are listed in the threadpane.

There is a regression when it comes to collapsed threads. In 115 the mailTabs API included in getSelectedMessages() messages of collapsed threads. This is no longer the case in 128. This is covered in Bug 1918885. As it stands, I will make getSelectedMessages() always return the collapsed messages. The new funtion getListedMessages will receive an option to include collapsed messages or not.

I will close this bug, but if you think I miss-understood something, do not hesitate to ping back.

Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.