Merge "Don't allow query and cookie hacks to enable topic subscriptions"

This commit is contained in:
jenkins-bot 2021-04-14 09:06:06 +00:00 committed by Gerrit Code Review
commit 5938e97250

View file

@ -228,19 +228,26 @@ class HookUtils {
}
// ?dtenable=1 overrides all user and title checks
if (
$output->getRequest()->getVal( 'dtenable' ) ||
$queryEnable = $output->getRequest()->getVal( 'dtenable' ) ||
// Extra hack for parses from API, where this parameter isn't passed to derivative requests
RequestContext::getMain()->getRequest()->getVal( 'dtenable' )
) {
RequestContext::getMain()->getRequest()->getVal( 'dtenable' );
// The cookie hack allows users to enable all features when they are not
// yet available on the wiki
$cookieEnable = $output->getRequest()->getCookie( 'discussiontools-tempenable' ) ?: false;
if ( $feature === self::TOPICSUBSCRIPTION ) {
// Can't be enabled via query/cookie, because the tables may not exist yet (T280082)
$queryEnable = false;
$cookieEnable = false;
}
if ( $queryEnable ) {
return true;
}
return static::isAvailableForTitle( $title ) && (
static::isFeatureEnabledForUser( $output->getUser(), $feature ) ||
// The cookie hack allows users to enable all features when they are not
// yet available on the wiki
$output->getRequest()->getCookie( 'discussiontools-tempenable' ) ?: false
$cookieEnable
);
}
}