Comment 293 for bug 52667

Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :

(From update of attachment 382384)
>diff --git a/mail/base/content/mail3PaneWindowCommands.js b/mail/base/content/mail3PaneWindowCommands.js
>--- a/mail/base/content/mail3PaneWindowCommands.js
>+++ b/mail/base/content/mail3PaneWindowCommands.js
>@@ -327,15 +327,25 @@
> goSetMenuValue(command, whichText);
> goSetAccessKey(command, whichText + "AccessKey");
> }
>+ let rv = false;
> if (GetNumSelectedMessages() > 0)
> {
> if (gDBView)
> {
> gDBView.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody, enabled, checkStatus);
>- return enabled.value;
>+ rv = enabled.value;
> }

While you're here, please combine this to one if statement, and then return early if (!enabled.value)

> }
>- return false;
>+ if (rv)
>+ {
>+ if (command == "cmd_reply" || command == "button_reply")
>+ rv = IsReplyEnabled();
>+ else if (command == "cmd_replyall" || command == "button_replyall")
>+ rv = IsReplyAllEnabled();
>+ else if (command == "cmd_replylist" || command == "button_replylist")
>+ rv = IsReplyListEnabled();
>+ }
>+ return rv;

Here too, no need for the rv, just |return IsReplyEnabled();| and so on

Forgot to mention it earlier, but some doxygen documentation for the new methods would be nice. Something along the lines of
/**
 * Get the folder type of the currently selected folder
 * @return the folder type, or null if we don't have a selected folder
 */

r=mkmelin with those