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

When one of the $wgEnableEmail and $wgEnableUserEmail variables is
false, "Email from other user" option should not be shown in
preferences.

Bug: T266087
Change-Id: I38e439b778d2679967776757d8e0d3b63519612e
This commit is contained in:
mech 2021-03-08 23:03:20 +01:00
parent 49530fddca
commit 2d8085bd15
No known key found for this signature in database
GPG key ID: 7FBFBFD17A45CAE7

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;