From 617e22564fd2d64c0267058c353797119ffe1cb6 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Wed, 29 Sep 2021 01:14:25 +0200 Subject: [PATCH] Add echo-cross-wiki-notifications to DefaultUserOptions Without the default the preference is never deleted from the database, even it was disabled by the user. Bug: T291748 Change-Id: Id7c79d8e8f0de4f1d3d624a16fc3783fbded7f49 --- includes/EchoHooks.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/EchoHooks.php b/includes/EchoHooks.php index 17c98d510..a478810ee 100644 --- a/includes/EchoHooks.php +++ b/includes/EchoHooks.php @@ -23,7 +23,7 @@ class EchoHooks implements RecentChange_saveHook { * @param array &$defaults */ public static function onUserGetDefaultOptions( array &$defaults ) { - global $wgAllowHTMLEmail, $wgEchoNotificationCategories, $wgEchoEnablePush; + global $wgAllowHTMLEmail, $wgEchoNotificationCategories, $wgEchoEnablePush, $wgEchoCrossWikiNotifications; if ( $wgAllowHTMLEmail ) { $defaults['echo-email-format'] = 'html'; /*EchoHooks::EMAIL_FORMAT_HTML*/ @@ -31,6 +31,10 @@ class EchoHooks implements RecentChange_saveHook { $defaults['echo-email-format'] = 'plain-text'; /*EchoHooks::EMAIL_FORMAT_PLAIN_TEXT*/ } + if ( $wgEchoCrossWikiNotifications ) { + $defaults['echo-cross-wiki-notifications'] = false; + } + $presets = [ // Set all of the events to notify by web but not email by default // (won't affect events that don't email) @@ -85,6 +89,13 @@ class EchoHooks implements RecentChange_saveHook { ?? $presets['default']['push']; } } + + foreach ( self::getVirtualUserOptions() as $echoPref => $mwPref ) { + // Use the existing core option's default for the Echo option's default + if ( isset( $defaults[ $mwPref ] ) ) { + $defaults[ $echoPref ] = $defaults[ $mwPref ]; + } + } } /**