r99391 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99390‎ | r99391 | r99392 >
Date:07:45, 10 October 2011
Author:siebrand
Status:ok
Tags:
Comment:
Follow-up r99204 per CR comment:
* remove redundant === check
* reduce indentation level
* fix typo in comment.
Modified paths:
  • /trunk/extensions/Translate/utils/UserToggles.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/UserToggles.php
@@ -25,24 +25,27 @@
2626 public static function onGetPreferences( $user, &$preferences ) {
2727 global $wgTranslateNewsletterPreference;
2828
29 - if( $wgTranslateNewsletterPreference === true ) {
30 - global $wgEnableEmail, $wgEnotifRevealEditorAddress;
31 - // Only show is e-mail is enabled and user has a confirmed e-mail address.
32 - if ( $wgEnableEmail && $user->isEmailConfirmed() ) {
33 - // 'translate-pref-nonewsletter' is used as opt-out for
34 - // users with a confirmed e-mail address
35 - $prefs = array(
36 - 'translate-nonewsletter' => array(
37 - 'type' => 'toggle',
38 - 'section' => 'personal/email',
39 - 'label-message' => 'translate-pref-nonewsletter'
40 - )
41 - );
 29+ if( !$wgTranslateNewsletterPreference ) {
 30+ return true;
 31+ }
4232
43 - // Add setting after 'enotifrevealaddr'
44 - $preferences = wfArrayInsertAfter( $preferences, $prefs,
45 - $wgEnotifRevealEditorAddress ? 'enotifrevealaddr' : 'enotifminoredits' );
46 - }
 33+ global $wgEnableEmail, $wgEnotifRevealEditorAddress;
 34+
 35+ // Only show if e-mail is enabled and user has a confirmed e-mail address.
 36+ if ( $wgEnableEmail && $user->isEmailConfirmed() ) {
 37+ // 'translate-pref-nonewsletter' is used as opt-out for
 38+ // users with a confirmed e-mail address
 39+ $prefs = array(
 40+ 'translate-nonewsletter' => array(
 41+ 'type' => 'toggle',
 42+ 'section' => 'personal/email',
 43+ 'label-message' => 'translate-pref-nonewsletter'
 44+ )
 45+ );
 46+
 47+ // Add setting after 'enotifrevealaddr'.
 48+ $preferences = wfArrayInsertAfter( $preferences, $prefs,
 49+ $wgEnotifRevealEditorAddress ? 'enotifrevealaddr' : 'enotifminoredits' );
4750 }
4851
4952 return true;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99204* Follow-up r99112: use $user instead of $wgUser....siebrand10:05, 7 October 2011

Status & tagging log