mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
Merge "Show new topics subscription button on history pages"
This commit is contained in:
commit
82bab7a4e6
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -584,6 +584,8 @@ class PageHooks implements
|
|||
'data-mw-subscribed' => $button['isSubscribed'] ? '1' : '0',
|
||||
'href' => $button['href'],
|
||||
];
|
||||
|
||||
$output->addModules( [ 'ext.discussionTools.init' ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue