Kaldari has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61282


Change subject: Changing how the enotifusertalkpages user option is handled by 
Echo
......................................................................

Changing how the enotifusertalkpages user option is handled by Echo

If we're using Echo to handle user talk page post notifications,
hide the old (non-Echo) preference for this. If Echo is moved to core
we'll want to remove this old user option entirely. For now, though,
we need to keep it defined in case Echo is ever uninstalled.
Otherwise, that preference could be lost entirely. This hiding logic
is not abstracted since there is only a single preference in core
that is potentially made obsolete by Echo.

Change-Id: I6c8b2143a5fd719486f7e6cbaa3d7635f507ffca
---
M Hooks.php
1 file changed, 13 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/82/61282/1

diff --git a/Hooks.php b/Hooks.php
index 8858fdc..b795ffc 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -256,7 +256,7 @@
         */
        public static function getPreferences( $user, &$preferences ) {
                global $wgEchoDefaultNotificationTypes, $wgAuth, 
$wgEchoEnableEmailBatch,
-                       $wgEchoNotifiers, $wgEchoNotificationCategories;
+                       $wgEchoNotifiers, $wgEchoNotificationCategories, 
$wgEchoNotifications;
 
                // Show email frequency options
                $never = wfMessage( 'echo-pref-email-frequency-never' 
)->plain();
@@ -324,9 +324,6 @@
 
                // Show subscription options
 
-               // $oldPrefs are prefs that we are replacing
-               $oldPrefs['email']['edit-user-talk'] = 'enotifusertalkpages';
-
                // Build the columns (output formats)
                $columns = array();
                foreach ( $wgEchoNotifiers as $notifierType => $notifierData ) {
@@ -360,14 +357,21 @@
                                } elseif ( 
!$wgEchoDefaultNotificationTypes['all'][$notifierType] ) {
                                        $removeOptions[] = 
"$notifierType-$category";
                                }
-
-                               // Unset redundant prefs while we're cycling 
through the matrix
-                               if ( isset( $oldPrefs[$notifierType][$category] 
) ) {
-                                       unset( 
$preferences[$oldPrefs[$notifierType][$category]] );
-                               }
                        }
                }
 
+               // If we're using Echo to handle user talk page post 
notifications,
+               // hide the old (non-Echo) preference for this. If Echo is 
moved to core
+               // we'll want to remove this old user option entirely. For now, 
though,
+               // we need to keep it defined in case Echo is ever uninstalled.
+               // Otherwise, that preference could be lost entirely. This 
hiding logic
+               // is not abstracted since there is only a single preference in 
core
+               // that is potentially made obsolete by Echo.
+               if ( isset( $wgEchoNotifications['edit-user-talk'] ) ) {
+                       $preferences['enotifusertalkpages']['type'] = 'hidden';
+                       unset( $preferences['enotifusertalkpages']['section'] );
+               }
+
                $preferences['echo-subscriptions'] = array(
                        'class' => 'HTMLCheckMatrix',
                        'section' => 'echo/echosubscriptions',

-- 
To view, visit https://gerrit.wikimedia.org/r/61282
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6c8b2143a5fd719486f7e6cbaa3d7635f507ffca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to