r105307 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105306‎ | r105307 | r105308 >
Date:15:48, 6 December 2011
Author:rsterbin
Status:ok
Tags:
Comment:
Added a hook for display options to do something on init, not just build form
Moved expertise bucketing for option 5 into init so that it only runs if option 5 is actually selected
Removed duplicate click tracking bucketing from ext.articleFeedbackv5.startup.js
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1152,8 +1152,9 @@
11531153
11541154 /**
11551155 * Only certain users can see the expertise checkboxes and email
 1156+ * (bucketed on init)
11561157 */
1157 - showOptions: 'show' === mw.user.bucket( 'ext.articleFeedbackv5-options', mw.config.get( 'wgArticleFeedbackv5Options' ) ),
 1158+ showOptions: false,
11581159
11591160 /**
11601161 * Whether we need to load the aggregate ratings the next time the button is
@@ -1247,6 +1248,17 @@
12481249 },
12491250
12501251 // }}}
 1252+ // {{{ init
 1253+
 1254+ /**
 1255+ * Initializes the bucket
 1256+ */
 1257+ init: function () {
 1258+ var opt = mw.user.bucket( 'ext.articleFeedbackv5-options', mw.config.get( 'wgArticleFeedbackv5Options' ) )
 1259+ $.articleFeedbackv5.currentBucket().showOptions = ( 'show' === opt );
 1260+ },
 1261+
 1262+ // }}}
12511263 // {{{ getTitle
12521264
12531265 /**
@@ -1867,6 +1879,10 @@
18681880 $.articleFeedbackv5.debug = mw.config.get( 'wgArticleFeedbackv5Debug' ) ? true : false;
18691881 // Go ahead and bucket right away
18701882 $.articleFeedbackv5.selectBucket();
 1883+ // Anything the bucket needs to do?
 1884+ if ( 'init' in $.articleFeedbackv5.currentBucket() ) {
 1885+ $.articleFeedbackv5.currentBucket().init();
 1886+ }
18711887 // When the tool is visible, load the form
18721888 $.articleFeedbackv5.$holder.appear( function () {
18731889 if ( !$.articleFeedbackv5.isLoaded ) {
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js
@@ -26,11 +26,6 @@
2727 // Not viewing the printable version
2828 && mw.util.getParamValue( 'printable' ) != 'yes'
2929 ) {
30 - // Assign a tracking bucket using options from wgArticleFeedbackv5Tracking
31 - mw.user.bucket(
32 - 'ext.articleFeedbackv5-tracking', mw.config.get( 'wgArticleFeedbackv5Tracking' )
33 - );
34 -
3530 // Collect categories for intersection tests
3631 var categories = {
3732 'include': mw.config.get( 'wgArticleFeedbackv5Categories', [] ),

Status & tagging log