mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 08:23:52 +00:00
Mobile config: Always enable reply/newtopic tools on mobile, disable subscriptions
Bug: T302326 Change-Id: I64ffc904046f7d9d2fa651c086876add35061e0a
This commit is contained in:
parent
ae554cdd66
commit
b4f10c5638
|
@ -533,7 +533,7 @@
|
||||||
},
|
},
|
||||||
"DiscussionToolsEnableMobile": {
|
"DiscussionToolsEnableMobile": {
|
||||||
"value": true,
|
"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": {
|
"DiscussionTools_replytool": {
|
||||||
"value": "default",
|
"value": "default",
|
||||||
|
|
|
@ -235,22 +235,6 @@ class HookUtils {
|
||||||
return false;
|
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
|
// Topic subscription is not available on your own talk page, as you will
|
||||||
// get 'edit-user-talk' notifications already. (T276996)
|
// get 'edit-user-talk' notifications already. (T276996)
|
||||||
if (
|
if (
|
||||||
|
@ -283,6 +267,23 @@ class HookUtils {
|
||||||
return false;
|
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 ) &&
|
return static::isAvailableForTitle( $title ) &&
|
||||||
static::isFeatureEnabledForUser( $output->getUser(), $feature );
|
static::isFeatureEnabledForUser( $output->getUser(), $feature );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue