Remove integration with removed MobileFrontend talk page tools

* Remove the hook we used to disable that feature
* Remove CSS that only applied when it was enabled
* Update code comments that referred to it

Bug: T319145
Change-Id: If21a04f6a087289d8249a786f7c991e5e12c9bed
This commit is contained in:
Bartosz Dziewoński 2023-04-03 21:41:42 +02:00
parent 24185a1471
commit 6a7d949703
6 changed files with 9 additions and 61 deletions

View file

@ -425,7 +425,6 @@
"BeforeCreateEchoEvent": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onBeforeCreateEchoEvent", "BeforeCreateEchoEvent": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onBeforeCreateEchoEvent",
"EchoGetBundleRules": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetBundleRules", "EchoGetBundleRules": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetBundleRules",
"EchoGetEventsForRevision": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetEventsForRevision", "EchoGetEventsForRevision": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetEventsForRevision",
"MinervaNeueTalkPageOverlay": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\MobileHooks::onMinervaNeueTalkPageOverlay",
"RevisionDataUpdates": "dataupdates", "RevisionDataUpdates": "dataupdates",
"LoadExtensionSchemaUpdates": "installer", "LoadExtensionSchemaUpdates": "installer",
"GetDoubleUnderscoreIDs": "parser", "GetDoubleUnderscoreIDs": "parser",

View file

@ -456,8 +456,7 @@ class HookUtils {
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' ); $dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' );
if ( $isMobile ) { if ( $isMobile ) {
// Enabling mobile removes MobileFrontend's reply and new topic tools, so always // DiscussionToolsEnableMobile controls all features on mobile
// enable these tools as a replacement.
return ( return (
$dtConfig->get( 'DiscussionToolsEnableMobile' ) || $dtConfig->get( 'DiscussionToolsEnableMobile' ) ||
static::determineUserABTestBucket( $output->getUser(), 'mobile' ) === 'test' static::determineUserABTestBucket( $output->getUser(), 'mobile' ) === 'test'

View file

@ -1,26 +0,0 @@
<?php
/**
* DiscussionTools mobile hooks
*
* @file
* @ingroup Extensions
* @license MIT
*/
namespace MediaWiki\Extension\DiscussionTools\Hooks;
class MobileHooks {
/**
* Decide whether mobile frontend should be allowed to activate
*
* @param \Title $title
* @param \OutputPage $output
* @return bool|void This hook can return false to abort, causing the talk overlay to not be shown
*/
public static function onMinervaNeueTalkPageOverlay( $title, $output ) {
if ( HookUtils::isFeatureEnabledForOutput( $output ) ) {
return false;
}
return true;
}
}

View file

@ -232,8 +232,7 @@ class PageHooks implements
] ); ] );
$output->addBodyClasses( 'ext-discussiontools-init-new-topic-opened' ); $output->addBodyClasses( 'ext-discussiontools-init-new-topic-opened' );
// Minerva doesn't show a new topic button by default, unless the MobileFrontend // Minerva doesn't show a new topic button.
// talk page feature is enabled, but we shouldn't depend on code from there.
$output->addHTML( Html::rawElement( 'div', $output->addHTML( Html::rawElement( 'div',
[ 'class' => 'ext-discussiontools-init-new-topic' ], [ 'class' => 'ext-discussiontools-init-new-topic' ],
( new ButtonWidget( [ ( new ButtonWidget( [
@ -244,7 +243,7 @@ class PageHooks implements
'flags' => [ 'progressive', 'primary' ], 'flags' => [ 'progressive', 'primary' ],
'infusable' => true, 'infusable' => true,
] ) ) ] ) )
// For compatibility with Minerva click tracking (T295490) // For compatibility with MobileWebUIActionsTracking logging (T295490)
->setAttributes( [ 'data-event-name' => 'talkpage.add-topic' ] ) ->setAttributes( [ 'data-event-name' => 'talkpage.add-topic' ] )
) ); ) );
} }

View file

@ -47,12 +47,6 @@ h1, h2, h3, h4, h5, h6 {
display: none; display: none;
} }
// No support for reply links in the mobile talk overlay
// stylelint-disable-next-line selector-class-pattern
.talk-overlay & {
display: none;
}
.ext-discussiontools-init-replylink { .ext-discussiontools-init-replylink {
&-reply { &-reply {
cursor: pointer; cursor: pointer;
@ -389,13 +383,6 @@ h1, h2, h3, h4, h5, h6 {
> h2 { > h2 {
flex-grow: 1; flex-grow: 1;
} }
// stylelint-disable-next-line selector-class-pattern
.client-js .skin-minerva--talk-simplified&.section-heading > h2 {
font: inherit;
margin: 0;
padding: 0;
}
} }
.ext-discussiontools-visualenhancements-enabled { .ext-discussiontools-visualenhancements-enabled {
@ -636,10 +623,8 @@ h1, h2, h3, h4, h5, h6 {
} }
.skin-minerva.ext-discussiontools-emptystate-shown { .skin-minerva.ext-discussiontools-emptystate-shown {
// The Minerva "Add topic" button is very eye-catching. // The mobile "Add topic" button is very eye-catching.
// No need to show it when the empty state banner is shown. // No need to show it when the empty state banner is shown.
// stylelint-disable-next-line selector-class-pattern
.minerva-talk-add-button,
.ext-discussiontools-init-new-topic { .ext-discussiontools-init-new-topic {
display: none; display: none;
} }
@ -748,18 +733,10 @@ h1, h2, h3, h4, h5, h6 {
} }
} }
// DiscussionToolsEnableMobile disables the Minerva simplified talk page
// (SkinMinerva::isSimplifiedTalkPageEnabled). This is enabled on all pages
// in the talk namespace (with wikitext content model, but this file is not
// loaded on non-wikitext pages).
//
// DiscussionToolsEnableMobile enables multiple features, including the reply tool. // DiscussionToolsEnableMobile enables multiple features, including the reply tool.
// // When we detect that it's enabled, hide the lede section, and show a "Read as wiki page" button
// Whenever we detect that DiscussionToolsEnableMobile is disabling the Minerva
// simplified talk page, hide the lede section, and show a "Read as wiki page" button
// to reveal it. // to reveal it.
// // The button will disable all DT features by removing feature CSS classes.
// The button will disable all DT features byt remove feature CSS classes.
// stylelint-disable-next-line selector-class-pattern // stylelint-disable-next-line selector-class-pattern
.skin-minerva.ns-talk.ext-discussiontools-replytool-enabled { .skin-minerva.ns-talk.ext-discussiontools-replytool-enabled {
&.ext-discussiontools-init-lede-hidden { &.ext-discussiontools-init-lede-hidden {

View file

@ -25,7 +25,7 @@ function onViewportChange() {
} }
function init( $container ) { function init( $container ) {
// For compatibility with Minerva click tracking (T295490) // For compatibility with MobileWebUIActionsTracking logging (T295490)
$container.find( '.section-heading' ).attr( 'data-event-name', 'talkpage.section' ); $container.find( '.section-heading' ).attr( 'data-event-name', 'talkpage.section' );
// Keyboard body classes // Keyboard body classes
@ -92,7 +92,7 @@ function init( $container ) {
) { ) {
// eslint-disable-next-line no-jquery/no-global-selector // eslint-disable-next-line no-jquery/no-global-selector
newTopicButton = OO.ui.infuse( $( '.ext-discussiontools-init-new-topic-button' ) ); newTopicButton = OO.ui.infuse( $( '.ext-discussiontools-init-new-topic-button' ) );
// For compatibility with Minerva click tracking (T295490) // For compatibility with MobileWebUIActionsTracking logging (T295490)
newTopicButton.$element.attr( 'data-event-name', 'talkpage.add-topic' ); newTopicButton.$element.attr( 'data-event-name', 'talkpage.add-topic' );
// eslint-disable-next-line no-jquery/no-global-selector // eslint-disable-next-line no-jquery/no-global-selector
var $newTopicWrapper = $( '.ext-discussiontools-init-new-topic' ); var $newTopicWrapper = $( '.ext-discussiontools-init-new-topic' );
@ -135,7 +135,7 @@ function init( $container ) {
}, 200 ) ); }, 200 ) );
} }
if ( !$readAsWikiPage ) { if ( !$readAsWikiPage ) {
// Read as wiki page button, copied from renderReadAsWikiPageButton in Minerva // Read as wiki page button, copied from old MobileFrontend/Minerva feature (removed in T319145)
$readAsWikiPage = $( '<button>' ) $readAsWikiPage = $( '<button>' )
.addClass( 'ext-discussiontools-init-readAsWikiPage' ) .addClass( 'ext-discussiontools-init-readAsWikiPage' )
.attr( 'data-event-name', 'talkpage.readAsWiki' ) .attr( 'data-event-name', 'talkpage.readAsWiki' )