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
This commit is contained in:
Umherirrender 2021-09-29 01:14:25 +02:00
parent a100d36e0d
commit 617e22564f

View file

@ -23,7 +23,7 @@ class EchoHooks implements RecentChange_saveHook {
* @param array &$defaults * @param array &$defaults
*/ */
public static function onUserGetDefaultOptions( array &$defaults ) { public static function onUserGetDefaultOptions( array &$defaults ) {
global $wgAllowHTMLEmail, $wgEchoNotificationCategories, $wgEchoEnablePush; global $wgAllowHTMLEmail, $wgEchoNotificationCategories, $wgEchoEnablePush, $wgEchoCrossWikiNotifications;
if ( $wgAllowHTMLEmail ) { if ( $wgAllowHTMLEmail ) {
$defaults['echo-email-format'] = 'html'; /*EchoHooks::EMAIL_FORMAT_HTML*/ $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*/ $defaults['echo-email-format'] = 'plain-text'; /*EchoHooks::EMAIL_FORMAT_PLAIN_TEXT*/
} }
if ( $wgEchoCrossWikiNotifications ) {
$defaults['echo-cross-wiki-notifications'] = false;
}
$presets = [ $presets = [
// Set all of the events to notify by web but not email by default // Set all of the events to notify by web but not email by default
// (won't affect events that don't email) // (won't affect events that don't email)
@ -85,6 +89,13 @@ class EchoHooks implements RecentChange_saveHook {
?? $presets['default']['push']; ?? $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 ];
}
}
} }
/** /**