r106973 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106972‎ | r106973 | r106974 >
Date:20:06, 21 December 2011
Author:rmoen
Status:ok
Tags:
Comment:
updated js globals hook to load inline
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.hooks.php (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/MoodBar.hooks.php
@@ -103,21 +103,20 @@
104104 * ResourceLoaderGetConfigVars hook
105105 */
106106 public static function resourceLoaderGetConfigVars( &$vars ) {
107 - global $wgMoodBarConfig, $wgUser, $wgEnableEmail;
 107+ global $wgMoodBarConfig, $wgUser;
108108 $vars['mbConfig'] = array(
109109 'validTypes' => MBFeedbackItem::getValidTypes(),
110 - 'userBuckets' => MoodBarHooks::getUserBuckets( $wgUser ),
111 - 'emailEnabled' => $wgEnableEmail,
112 - 'userEmail' => strlen( $wgUser->getEmail() ) > 0 ? true : false,
113 - 'isEmailConfirmationPending' => $wgUser->isEmailConfirmationPending() //returns false if email authentication off, and if email is confimed already
114 -
 110+ 'userBuckets' => MoodBarHooks::getUserBuckets( $wgUser )
115111 ) + $wgMoodBarConfig;
116112 return true;
117113 }
118114
119115 public static function makeGlobalVariablesScript( &$vars ) {
120 - global $wgUser;
 116+ global $wgUser, $wgEnableEmail;
121117 $vars['mbEditToken'] = $wgUser->editToken();
 118+ $vars['mbEmailEnabled'] = $wgEnableEmail;
 119+ $vars['mbUserEmail'] = strlen( $wgUser->getEmail() ) > 0 ? true : false;
 120+ $vars['mbIsEmailConfirmationPending'] = $wgUser->isEmailConfirmationPending(); //returns false if email authentication off, and if email is confimed already
122121 return true;
123122 }
124123
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js
@@ -137,11 +137,11 @@
138138 var emailFlag,emailOptOut = ($.cookie( mb.cookiePrefix() + 'emailOptOut' ) == '1');
139139
140140 // if opt out cookie not set and if email is on globally, proceed with email prompt
141 - if( emailOptOut === false && mb.conf.emailEnabled ) {
 141+ if( emailOptOut === false && mw.config.get( 'mbEmailEnabled' ) ) {
142142
143 - if( mb.conf.userEmail ) { // if user has email
 143+ if( mw.config.get( 'mbUserEmail' ) ) { // if user has email
144144
145 - if ( !mb.conf.isEmailConfirmationPending ) { // if no confirmation pending, show form.
 145+ if ( !mw.config.get( 'mbIsEmailConfirmationPending' ) ) { // if no confirmation pending, show form.
146146 mb.showSuccess();
147147
148148 } else { //show email confirmation form
@@ -179,8 +179,7 @@
180180 callback: function( data ) {
181181 mb.showSuccess();
182182 //set email flag to true so we do not ask again on this page load.
183 - mb.conf.userEmail = true;
184 - mb.conf.isEmailConfirmationPending = true;
 183+ mw.config.set({'mbUserEmail': true, 'mbIsEmailConfirmationPending': true});
185184 }
186185 },
187186
@@ -188,7 +187,7 @@
189188 callback: function ( data ) {
190189 mb.showSuccess();
191190 //set conf pending flag to false so we do not ask again on this page load.
192 - mb.conf.isEmailConfirmationPending = false;
 191+ mw.config.set({'mbIsEmailConfirmationPending': false});
193192 }
194193
195194 },

Status & tagging log