r81327 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81326‎ | r81327 | r81328 >
Date:22:02, 1 February 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Added clicktracking to toolbox link and made use of mw.config rather than globals.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js
@@ -249,10 +249,12 @@
250250 'edit': {
251251 'condition': function() {
252252 // An empty restrictions array means anyone can edit
253 - if ( wgRestrictionEdit.length ) {
 253+ var restrictions = mediaWiki.config.get( 'wgRestrictionEdit' );
 254+ var groups = mediaWiki.config.get( 'wgUserGroups' );
 255+ if ( restrictions.length ) {
254256 // Verify that each restriction exists in the user's groups
255 - for ( var i = 0; i < wgRestrictionEdit.length; i++ ) {
256 - if ( !$.inArray( wgRestrictionEdit[i], wgUserGroups ) ) {
 257+ for ( var i = 0; i < restrictions.length; i++ ) {
 258+ if ( !$.inArray( restrictions[i], groups ) ) {
257259 return false;
258260 }
259261 }
@@ -288,6 +290,10 @@
289291 .find( '#t-articlefeedback a' )
290292 .text( mw.msg( 'articlefeedback-form-switch-label' ) )
291293 .click( function() {
 294+ // Track the click so we can figure out how useful this is
 295+ if ( typeof $.trackActionWithInfo == 'function' ) {
 296+ $.trackActionWithInfo( 'articlefeedback-toolbox-link', mediaWiki.config.get( 'wgTitle' ) )
 297+ }
292298 // Get the image, set the count and an interval.
293299 var $box = $( '#mw-articlefeedback' );
294300 var count = 0;

Status & tagging log