Merge "Unset user-to-user email option when user emails are disabled"

This commit is contained in:
jenkins-bot 2021-03-12 09:29:40 +00:00 committed by Gerrit Code Review
commit a2933f5c8b

View file

@ -85,7 +85,8 @@ class EchoHooks implements RecentChange_saveHook {
public static function initEchoExtension() {
global $wgEchoNotifications, $wgEchoNotificationCategories, $wgEchoNotificationIcons,
$wgEchoMentionStatusNotifications, $wgAllowArticleReminderNotification, $wgAPIModules,
$wgEchoWatchlistNotifications, $wgEchoSeenTimeCacheType, $wgMainStash;
$wgEchoWatchlistNotifications, $wgEchoSeenTimeCacheType, $wgMainStash, $wgEnableEmail,
$wgEnableUserEmail;
// allow extensions to define their own event
Hooks::run( 'BeforeCreateEchoEvent',
@ -109,6 +110,11 @@ class EchoHooks implements RecentChange_saveHook {
unset( $wgEchoNotificationCategories['minor-watchlist'] );
}
// Only allow user email notifications when enabled
if ( !$wgEnableEmail || !$wgEnableUserEmail ) {
unset( $wgEchoNotificationCategories['emailuser'] );
}
// Default $wgEchoSeenTimeCacheType to $wgMainStash
if ( $wgEchoSeenTimeCacheType === null ) {
$wgEchoSeenTimeCacheType = $wgMainStash;