r105030 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105029‎ | r105030 | r105031 >
Date:00:14, 3 December 2011
Author:rsterbin
Status:deferred
Tags:
Comment:
Enabling submission now sets an internal state, and submitForm() checks it
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -72,6 +72,11 @@
7373 $.articleFeedbackv5.inDialog = false;
7474
7575 /**
 76+ * Is form submission enabled?
 77+ */
 78+ $.articleFeedbackv5.submissionEnabled = false;
 79+
 80+ /**
7681 * The bucket ID is the variation of the Article Feedback form chosen for this
7782 * particualar user. It set at load time, but if all else fails, default to
7883 * Bucket 6 (no form).
@@ -1480,6 +1485,7 @@
14811486 } else {
14821487 $.articleFeedbackv5.find( '.articleFeedbackv5-pending span' ).hide();
14831488 }
 1489+ $.articleFeedbackv5.submissionEnabled = state;
14841490 },
14851491
14861492 // }}}
@@ -2026,6 +2032,7 @@
20272033 if ( 'enableSubmission' in bucket ) {
20282034 bucket.enableSubmission( state );
20292035 }
 2036+ $.articleFeedbackv5.submissionEnabled = state;
20302037 };
20312038
20322039 // }}}
@@ -2145,6 +2152,11 @@
21462153 */
21472154 $.articleFeedbackv5.submitForm = function () {
21482155
 2156+ // Are we allowed to do this?
 2157+ if ( !$.articleFeedbackv5.submissionEnabled ) {
 2158+ return false;
 2159+ }
 2160+
21492161 // For anonymous users, keep a cookie around so we know they've rated before
21502162 if ( mw.user.anonymous() ) {
21512163 $.cookie( $.articleFeedbackv5.prefix( 'rated' ), 'true', { 'expires': 365, 'path': '/' } );

Status & tagging log