Clean up ham/spam button toggling
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 18 Dec 2009 23:02:46 +0000 (16:02 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 18 Dec 2009 23:37:46 +0000 (16:37 -0700)
imp/js/DimpBase.js

index ed99c3c..5c50266 100644 (file)
@@ -520,6 +520,7 @@ var DimpBase = {
 
         container.observe('ViewPort:contentComplete', function(e) {
             var ssc, tmp,
+                ham = spam = 'show',
                 l = this.viewport.getMetaData('label');
 
             this.setMessageListTitle();
@@ -564,19 +565,18 @@ var DimpBase = {
                 }
 
                 if (this.folder == DIMP.conf.spam_mbox) {
-                    if (!DIMP.conf.spam_spammbox && $('button_spam')) {
-                        [ $('button_spam').up(), $('ctx_message_spam') ].invoke('hide');
-                    }
-                    if ($('button_ham')) {
-                        [ $('button_ham').up(), $('ctx_message_ham') ].invoke('show');
-                    }
-                } else {
-                    if ($('button_spam')) {
-                        [ $('button_spam').up(), $('ctx_message_spam') ].invoke('show');
-                    }
-                    if ($('button_ham')) {
-                        [ $('button_ham').up(), $('ctx_message_ham') ].invoke(DIMP.conf.ham_spammbox ? 'hide' : 'show');
+                    if (!DIMP.conf.spam_spammbox) {
+                        spam = 'hide';
                     }
+                } else if (DIMP.conf.ham_spammbox) {
+                    ham = 'hide';
+                }
+
+                if ($('button_ham')) {
+                    [ $('button_ham').up(), $('ctx_message_ham') ].invoke(ham);
+                }
+                if ($('button_spam')) {
+                    [ $('button_spam').up(), $('ctx_message_spam') ].invoke(spam);
                 }
 
                 /* Read-only changes. 'oa_setflag' is handled elsewhere. */