Merge "Show new topics subscription button on history pages"

This commit is contained in:
jenkins-bot 2023-09-26 17:40:55 +00:00 committed by Gerrit Code Review
commit 82bab7a4e6
3 changed files with 18 additions and 3 deletions

View file

@ -415,8 +415,14 @@ class HookUtils {
// Don't try to call $output->getActionName if testing for NEWTOPICTOOL as we use
// the hook onGetActionName to override the action for the tool on empty pages.
// If we tried to call it here it would set up infinite recursion (T312689)
$feature !== static::NEWTOPICTOOL &&
!in_array( $output->getActionName(), [ 'view', 'edit', 'submit' ], true )
$feature !== static::NEWTOPICTOOL && !(
in_array( $output->getActionName(), [ 'view', 'edit', 'submit' ], true ) ||
// Subscriptions (specifically page-level subscriptions) are available on history pages (T345096)
(
$output->getActionName() === 'history' &&
$feature === static::TOPICSUBSCRIPTION
)
)
) {
return false;
}

View file

@ -584,6 +584,8 @@ class PageHooks implements
'data-mw-subscribed' => $button['isSubscribed'] ? '1' : '0',
'href' => $button['href'],
];
$output->addModules( [ 'ext.discussionTools.init' ] );
}
}

View file

@ -79,11 +79,18 @@ if ( url.searchParams.get( 'dtdebug' ) ) {
mw.hook( 'wikipage.content' ).add( mw.dt.init );
}
var topicSubscriptions;
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'TopicSubscriptions' ) {
var topicSubscriptions = require( './topicsubscriptions.js' );
topicSubscriptions = require( './topicsubscriptions.js' );
topicSubscriptions.initSpecialTopicSubscriptions();
}
if ( mw.config.get( 'wgAction' ) === 'history' ) {
topicSubscriptions = require( './topicsubscriptions.js' );
topicSubscriptions.initNewTopicsSubscription();
}
// Clean up old localStorage entries that were erroneously set with no expiration (T339042).
// We are no longer using these keys since T329299.
// TODO: Remove this code after a few weeks.