r108158 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108157‎ | r108158 | r108159 >
Date:18:15, 5 January 2012
Author:rmoen
Status:ok
Tags:
Comment:
remove redundant mahEditToken and use existing user edit token. follow up r106740
Modified paths:
  • /trunk/extensions/MarkAsHelpful/MarkAsHelpful.hooks.php (modified) (history)
  • /trunk/extensions/MarkAsHelpful/MarkAsHelpful.php (modified) (history)
  • /trunk/extensions/MarkAsHelpful/modules/ext.markAsHelpful/ext.markAsHelpful.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MarkAsHelpful/MarkAsHelpful.php
@@ -45,7 +45,6 @@
4646
4747 $wgHooks['BeforePageDisplay'][] = 'MarkAsHelpfulHooks::onPageDisplay';
4848 $wgHooks['LoadExtensionSchemaUpdates'][] = 'MarkAsHelpfulHooks::onLoadExtensionSchemaUpdates';
49 -$wgHooks['MakeGlobalVariablesScript'][] = 'MarkAsHelpfulHooks::makeGlobalVariablesScript';
5049
5150 // Special pages
5251
Index: trunk/extensions/MarkAsHelpful/MarkAsHelpful.hooks.php
@@ -37,10 +37,4 @@
3838 return true;
3939 }
4040
41 - public static function makeGlobalVariablesScript( &$vars ) {
42 - global $wgUser;
43 - $vars['mahEditToken'] = $wgUser->editToken();
44 - return true;
45 - }
46 -
4741 }
Index: trunk/extensions/MarkAsHelpful/modules/ext.markAsHelpful/ext.markAsHelpful.js
@@ -23,7 +23,6 @@
2424 }
2525 });
2626 },
27 -
2827 /*
2928 * Return object of item properties
3029 */
@@ -37,7 +36,6 @@
3837 };
3938 return properties;
4039 },
41 -
4240 /*
4341 * Load the current state of the MarkAsHelpful item
4442 */
@@ -58,7 +56,8 @@
5957 data: request,
6058 success: function( data ) {
6159
62 - if ( data && data.getmarkashelpfulitem.result == 'success' &&
 60+ if ( data.getmarkashelpfulitem &&
 61+ data.getmarkashelpfulitem.result == 'success' &&
6362 data.getmarkashelpfulitem.formatted
6463 ) {
6564 var $content = $( data.getmarkashelpfulitem.formatted );
@@ -88,7 +87,7 @@
8988 'page': mw.config.get( 'wgPageName' ),
9089 'useragent': clientData.name + '/' + clientData.versionNumber,
9190 'system': clientData.platform,
92 - 'token': mw.config.get( 'mahEditToken' ),
 91+ 'token': mw.user.tokens.get( 'editToken' ),
9392 'format': 'json'
9493 }, props );
9594
@@ -101,7 +100,6 @@
102101 },
103102 dataType: 'json'
104103 } );
105 -
106104 }
107105 };
108106

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106740added global Variables hook to use correct edit tokenrmoen00:25, 20 December 2011

Status & tagging log