Mobile config: Always enable reply/newtopic tools on mobile, disable subscriptions

Bug: T302326
Change-Id: I64ffc904046f7d9d2fa651c086876add35061e0a
This commit is contained in:
Ed Sanders 2022-02-22 18:42:13 +00:00 committed by Bartosz Dziewoński
parent ae554cdd66
commit b4f10c5638
2 changed files with 18 additions and 17 deletions

View file

@ -533,7 +533,7 @@
},
"DiscussionToolsEnableMobile": {
"value": true,
"description": "Enable DiscussionTools on mobile talk pages."
"description": "Enable DiscussionTools on mobile talk pages. Currently this automatically enables 'replytool', 'newtopictool' & 'sourcemodetoolbar' on those pages and disables topic subscriptions on those pages."
},
"DiscussionTools_replytool": {
"value": "default",

View file

@ -235,22 +235,6 @@ class HookUtils {
return false;
}
$isMobile = false;
if ( ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) {
$mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
$isMobile = $mobFrontContext->shouldDisplayMobileView();
}
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' );
if ( $isMobile && (
!$dtConfig->get( 'DiscussionToolsEnableMobile' ) ||
// Still disable some features for now
$feature === self::TOPICSUBSCRIPTION
) ) {
return false;
}
// Topic subscription is not available on your own talk page, as you will
// get 'edit-user-talk' notifications already. (T276996)
if (
@ -283,6 +267,23 @@ class HookUtils {
return false;
}
$isMobile = false;
if ( ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) {
$mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
$isMobile = $mobFrontContext->shouldDisplayMobileView();
}
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' );
if ( $isMobile && $dtConfig->get( 'DiscussionToolsEnableMobile' ) ) {
// Enabling mobile removes MobileFrontend's reply and new topic tools, so always
// enable these tools as a replacement.
// Topic subscription is not yet available on mobile, awaiting UI implementation.
return $feature === null ||
$feature === self::REPLYTOOL ||
$feature === self::NEWTOPICTOOL ||
$feature === self::SOURCEMODETOOLBAR;
}
return static::isAvailableForTitle( $title ) &&
static::isFeatureEnabledForUser( $output->getUser(), $feature );
}