Closed Bug 145798 Opened 23 years ago Closed 21 years ago

Create Filter from Message is not doable when message pane is closed.

Categories

(SeaMonkey :: MailNews: Message Display, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: laurel, Assigned: sspitzer)

References

Details

Attachments

(1 file, 7 obsolete files)

Using current trunk/branch This was never expressly discussed in the spec, has since been mentioned in bug 143683 (duh, I didn't relate that original description to this simple request), but am opening a more clearly defined bug here. The main menu item Message|Create Filter from Message is disabled if the message pane is closed. Therefore, you cannot create a sender filter (say for a spammer) unless you've opened the message. 1. Go to main mail window, close message pane. 2. Select a message in the thread pane --> Message|Create Filter from Message is disabled. Result: can't create a filter from message unless you open the message/load contents. Expected: can create a filter from message (main menu item) without message opened.
QA Contact: olgam → laurel
Keywords: nsbeta1
Summary: Create Filter from Message is not when message pane is closed. → Create Filter from Message is not doable when message pane is closed.
Sorry, this is indeed in the spec that it should work with message pane closed.
Severity: normal → major
Keywords: adt1.0.1
Sorry, reread the comments for new keywords -- removing inappropriate adt1.0.1
Keywords: adt1.0.1
Discussed in mail news bug meeting. Decided to minus this bug.
Keywords: nsbeta1nsbeta1-
Target Milestone: --- → mozilla1.2alpha
nominating again for next release
Keywords: nsbeta1-nsbeta1
Using Mozilla 1.2 Build 20021126 the context-menu supports a "Create Filter from Message" on *any mail adress* right-clicked in the *mailheader* pane. (So it would better be labeled "Create Filter From Adress") Mark fixed?
Mail triage team: nsbeta1-
Keywords: nsbeta1-
Keywords: nsbeta1
mass re-assign.
Assignee: naving → sspitzer
*** Bug 229422 has been marked as a duplicate of this bug. ***
This is still true, per the original description; comment 5 is orthogonal to this issue. Reducing severity, resetting milestone. This would probably be a pretty simple bug for a JavaScript hacker to tackle.
Severity: major → minor
Target Milestone: mozilla1.2alpha → ---
This seems to do the trick, but it's a little messier than I imagined; to generate the author's email address from the message URI, there's a bunch of relatively heavyweight code.
Attachment #141689 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 141689 [details] [diff] [review] Attempt at fix (diff -u 3 -w against 1.6 Final) >+ var msgUri = GetFirstSelectedMessage(); >+ var msgService = messenger.messageServiceFromURI(msgUri); >+ if (msgService) { >+ var msgHdr = msgService.messageURIToMsgHdr(msgUri); >+ if (msgHdr) { Try using gDBView.hdrForFirstSelectedMessage instead. >+ var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); >+ var authorEmailAddress = new Object; >+ headerParser.extractHeaderAddressMailboxes(null, msgHdr.author, authorEmailAddress); >+ emailAddress = authorEmailAddress.value; Yes, this is ugly. Ideally you would change line 85 of nsIMsgHeaderParser.idl to string extractHeaderAddressMailboxes (in string charset, in string line); so that you could write emailAddress = headerParser.extractHeaderAddressMailboxes(null, gDBView.hdrForFirstSelectedMessage.author); instead. (You would also have to fix lines 588-590 of mailCommands.js in a similar way.)
Thanks Neil. > Ideally you would change line 85 of nsIMsgHeaderParser.idl > to string extractHeaderAddressMailboxes(...) > I'm not likely to address anything in any files that aren't in the chrome directory; I'm living with 28.8 dialup most of the time, and I'm not willing to start running CVS under those conditions. If my patch goes thru, I'll open another bug for that issue.
Second pass at a fix, with the first of Neil's comments implemented -- that worked fine, of course.
Attachment #141689 - Attachment is obsolete: true
Attachment #141689 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #141709 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 141709 [details] [diff] [review] Attempt at fix (diff -u 3 -w against 1.6 Final) I can't get your patch to apply, can you attach a -u only version please?
Attachment #141709 - Flags: review?(neil.parkwaycc.co.uk)
Same patch, diff'd without the -w switch.
Attachment #141709 - Attachment is obsolete: true
Attachment #142686 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 142686 [details] [diff] [review] Attempt at fix (diff -u against 1.6 Final) I eventually ended up applying this by hand, there are some subtle whitespace differences between this patch and the 1.6 release tag...
Attachment #142686 - Flags: review?(neil.parkwaycc.co.uk) → review+
It would be nice to fix extractHeaderAddressMailboxes before this goes in.
Depends on: 234867
Attached patch Updated patch to the trunk (obsolete) — Splinter Review
Attachment #142686 - Flags: superreview?(bienvenu)
won't this break creating a message filter from the stand-alone message window?
Dang, you're right. Is there a better way to addres that than changing the first 'if' to: if ((typeof(IsMessageDisplayedInMessagePane) == 'undefined') || IsMessageDisplayedInMessagePane()) { ... ?
'IsMessageDisplayedInMessagePane' in window
OK, here's a patch with timeless's idiom that works for the 3pane and the standalone; it's diffed against today's build, and shouldn't have any of those nasty whitespace problems.
Attachment #142686 - Attachment is obsolete: true
Attachment #143236 - Attachment is obsolete: true
Attachment #142686 - Flags: superreview?(bienvenu)
Comment on attachment 143526 [details] [diff] [review] Revised patch -- -u against 1.7-0310 Re-requesting reviews (I hope I'm doing this right...)
Attachment #143526 - Flags: superreview?(bienvenu)
Attachment #143526 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #143526 - Flags: superreview?(bienvenu) → superreview+
(In reply to comment #20) >Dang, you're right. Double dang :-[ >Is there a better way to address that Yes! In messageWindow.js, call MsgCreateFilter(true); in mail3PaneWindowCommands.js, MsgCreateFilter(IsMessageDisplayedInMessagePane());
Attached patch Nicer approach (obsolete) — Splinter Review
Actually there's a much nicer way [sound of head striking desk]: Always load the header from the message, don't bother with the crufty logic of determining the window mode and loading it out of the envelope panel.
Attachment #143526 - Attachment is obsolete: true
Attachment #143526 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 143531 [details] [diff] [review] Nicer approach Sorry for all the thrashing about here!
Attachment #143531 - Flags: superreview?(bienvenu)
Attachment #143531 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #143531 - Flags: superreview?(bienvenu)
Attachment #143531 - Flags: review?(neil.parkwaycc.co.uk)
This is embarrassing: I uploaded the wrong patch.
Attachment #143531 - Attachment is obsolete: true
Attachment #143533 - Flags: superreview?(bienvenu)
Attachment #143533 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 143533 [details] [diff] [review] Nicer approach: the correct file -u against 1.7-0310 Please note that hdrForFirstSelectedMessage never returns null, it will throw an exception if no message is selected.
and please please don't rely on that behavior. i want to fix callers to not call it if there aren't any selected messages. those exceptions cause me significant pain when i use venkman and mail.
Interesting. Is it OK to simply rely on the fact that the menu item is disabled if there is no message selected? If not, what's the nicest way to address this -- a try{} around the access to "gDBView.hdrForFirstSelectedMessage"? Test for ("hdrForFirstSelectedMessage" in gDBView)? Or check the selected-message count?
gDBView && gDBView.numSelected
(In reply to comment #31) > gDBView && gDBView.numSelected Unfortunately, that also fails for the standalone window case. The only potentially useful member of gDBView is currentlyDisplayedMessage -- which is set to (unsigned long)-1 if no message is selected. I am inclined to let the menu's disabling cover this instance. If that's not sufficient, I'd put a try block there.
Removing dependency as it is no longer relevant. Most of the exceptions timeless is complaining about are in the checks to see if the menuitems should be enabled in the first place ;-) Both versions of doCommand do an extra isCommandEnabled check although I thought that goDoCommand already does that check...
No longer depends on: 234867
I think the dependency is still valid, since my patch relies on the difference in that other bug's patch. I have a slight update to the patch -- an efficiency tweak in the isCommandEnabled() code in mail3PaneWindowCommand. I'll put it up as soon as I get a definite word on how to address timeless's issue. If I understand Neil right, he's advocating not doing anything special; instead, his comment 28 recommended removing the superfluous 'if' I had in place originally.
The bit of the patch that affects your patch got checked in, so any remaining issues keeping that bug open shouldn't keep this bug open. Yes, I am recommending removing the 'if'. Which isCommandEnabled do you mean? I hope you mean the one that's part of var DefaultController.
Took out the superfluous conditional. Made the defaultcontroller isCommandEnabled() a little more compact. Did not add any protection against the possibility of an exception thrown by accessing |gDBView.hdrForFirstSelectedMessage|. This code is not executed until the menu action has been selected, and if the menu item is enabled, there shouldn't be an exception.
Attachment #143533 - Attachment is obsolete: true
Attachment #143752 - Flags: superreview?(bienvenu)
Attachment #143752 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #143533 - Flags: superreview?(bienvenu)
Attachment #143533 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 143752 [details] [diff] [review] Better version diff -u against 1.7-0312 > case "cmd_createFilterFromPopup": >+ case "cmd_createFilterFromMenu": > var loadedFolder = GetLoadedMsgFolder(); > if (!(loadedFolder && loadedFolder.server.canHaveFilters)) >- return false; >- case "cmd_createFilterFromMenu": >- loadedFolder = GetLoadedMsgFolder(); >- if (!(loadedFolder && loadedFolder.server.canHaveFilters) || !(IsMessageDisplayedInMessagePane())) >- return false; >+ return false; // else fall thru Although it's not clear why there was a fall through in the first place...
Attachment #143752 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #143752 - Flags: superreview?(bienvenu) → superreview+
Comment on attachment 143752 [details] [diff] [review] Better version diff -u against 1.7-0312 Requesting approval for this low-risk bug.
Attachment #143752 - Flags: approval1.7b?
(In reply to comment #37) > Although it's not clear why there was a fall through in the first place... It was a four-stage fall-thru with a redundant clause in the cmd_CreateFilterFromPopup; now it's a three-stage fall-thru where there's no redundancy, just the canCreateFilter test being shared by the two CreateFilter commands.
Comment on attachment 143752 [details] [diff] [review] Better version diff -u against 1.7-0312 a=chofmann for 1.7b
Attachment #143752 - Flags: approval1.7b? → approval1.7b+
Fix checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: