jenkins-bot has submitted this change and it was merged.

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(-)

Approvals:
  Matthias Mullie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Hooks.php b/Hooks.php
index 8858fdc..15720ed 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,11 +357,6 @@
                                } 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]] );
-                               }
                        }
                }
 
@@ -376,6 +368,18 @@
                        'remove-options' => $removeOptions,
                );
 
+               // 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'] );
+               }
+
                // Show fly-out display prefs
                // Per bug 47562, we're going to hide this pref for now until 
we see
                // what the community reaction to Echo is on en.wiki.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c8b2143a5fd719486f7e6cbaa3d7635f507ffca
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to