r90134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90133‎ | r90134 | r90135 >
Date:18:39, 15 June 2011
Author:janpaul123
Status:ok
Tags:
Comment:
Followup to r90133 as this was still incorrect.
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.hooks.php (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.hooks.php
@@ -43,34 +43,33 @@
4444 }
4545
4646 /**
47 - * Adds the required module and edit token JS if we are on a user (talk) page.
 47+ * Adds the required module if we are on a user (talk) page.
4848 *
4949 * @param $output
5050 * @param $skin Skin
5151 */
5252 public static function beforePageDisplay( $out, $skin ) {
5353 global $wgWikiLoveGlobal, $wgUser;
54 - if ( !$wgWikiLoveGlobal && !$wgUser->getOption( 'wikilove-enabled' ) ) return true;
 54+ if ( !$wgWikiLoveGlobal && !$wgUser->getOption( 'wikilove-enabled' ) ) {
 55+ return true;
 56+ }
5557
5658 $title = self::getUserTalkPage( $skin->getTitle() );
5759 if ( !is_null( $title ) ) {
5860 $out->addModules( 'ext.wikiLove.icon' );
5961 $out->addModules( 'ext.wikiLove.init' );
6062 self::$recipient = $title->getText();
61 - $out->addInlineScript(
62 - 'jQuery( document ).ready( function() {
63 - jQuery.wikiLove.editToken = ' . FormatJson::encode( $wgUser->edittoken() ) . ';
64 - } );'
65 - );
6663 }
6764 return true;
6865 }
6966
7067 /**
71 - * Exports wikilove-recipient variable to JS
 68+ * Exports wikilove-recipient and edittoken variables to JS
7269 */
7370 public static function makeGlobalVariablesScript( &$vars ) {
 71+ global $wgUser;
7472 $vars['wikilove-recipient'] = self::$recipient;
 73+ $vars['wikilove-edittoken'] = $wgUser->edittoken();
7574 return true;
7675 }
7776
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -7,7 +7,6 @@
88 currentSubtypeId = null, // id of the currently selected subtype (e.g. 'original' or 'special')
99 currentTypeOrSubtype = null, // content of the current (sub)type (i.e. an object with title, descr, text, etc.)
1010 previewData = null, // data of the currently previewed thing is set here
11 - editToken = '', // edit token used for the final AJAX call (deprecated after 1.17)
1211 emailable = false,
1312 gallery = {};
1413
@@ -385,7 +384,7 @@
386385 'text': wikitext,
387386 'message': message,
388387 'subject': subject,
389 - 'token': $.wikiLove.editToken // after 1.17 this can become mw.user.tokens.get( 'editToken' )
 388+ 'token': mw.config.get( 'wikilove-edittoken' ) // after 1.17 this can become mw.user.tokens.get( 'editToken' )
390389 };
391390
392391 if ( email ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r901351.17wmf1: MFT r90133, r90134catrope18:44, 15 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90133Reverted r88565 for now for 1.17wmf1 compatibilityjanpaul12318:32, 15 June 2011

Status & tagging log