Closed Bug 786189 Opened 8 years ago Closed 8 years ago

Make more use of selectedMessageIs

Categories

(SeaMonkey :: MailNews: Message Display, defect)

defect
Not set
normal

Tracking

(seamonkey2.15 fixed)

RESOLVED FIXED
seamonkey2.15
Tracking Status
seamonkey2.15 --- fixed

People

(Reporter: iann_bugzilla, Assigned: iann_bugzilla)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Use selectedMessageIs more (obsolete) — Splinter Review
Bug 517238 introduced selectedMessageIsNews and selectedMessageIsImap, these both could be used more and functions like IsNewsMessage and IsImapMessage could be removed from mailWindowOverlay.js and also other code simplification. This ports part of Bug 474701.

Brackets after "if (numSelected >= 0)" in mailContextMenus.js have been deliberately left as will be needed again for a follow-up bug.
Attachment #655926 - Flags: review?(neil)
Assignee: nobody → iann_bugzilla
Status: NEW → ASSIGNED
Version: unspecified → Trunk
Blocks: 786200
This works in the standalone message window too?
(Somehow calling it gFolderDisplay looks wrong...)
(In reply to neil@parkwaycc.co.uk from comment #1)
> This works in the standalone message window too?
> (Somehow calling it gFolderDisplay looks wrong...)

Yes, it does work and yes it does look wrong, but we're stuck with that name to maintain compatibility for extensions.
Comment on attachment 655926 [details] [diff] [review]
Use selectedMessageIs more

>   if (numSelected >= 0)
>   {
>-    selectedMessage = GetFirstSelectedMessage();
>-    isNewsgroup = IsNewsMessage(selectedMessage);
>+    isNewsgroup = gFolderDisplay.selectedMessageIsNews;
>   }
[Weird, why are we checking for numSelected >= 0?]
Attachment #655926 - Flags: review?(neil) → review+
Changes since last version:
* As selectedMessageIsNews only checks the first selected message no need to check the numSelected.
Attachment #655926 - Attachment is obsolete: true
Attachment #655996 - Flags: review?(neil)
Comment on attachment 655996 [details] [diff] [review]
Less numSelected [Checked in: Comment 6]

>   var numSelected = GetNumSelectedMessages();
>   var oneOrMore = (numSelected > 0);
>   var single = (numSelected == 1);
[Might it be slightly neater to put isNewsgroup in this block?]
Attachment #655996 - Flags: review?(neil) → review+
Comment on attachment 655996 [details] [diff] [review]
Less numSelected [Checked in: Comment 6]

Checked in with var isNewsgroup moved to earlier block.
https://hg.mozilla.org/comm-central/rev/c7bf9a085fc4
Attachment #655996 - Attachment description: Less numSelected → Less numSelected [Checked in: Comment 6]
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: in-testsuite-
Flags: in-qa-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.15
You need to log in before you can comment on or make changes to this bug.