Merge "When opening new topic tool using any link, always activate the link in page tabs too"

This commit is contained in:
jenkins-bot 2021-08-17 15:51:29 +00:00 committed by Gerrit Code Review
commit 359b80ed70

View file

@ -447,8 +447,12 @@ function init( $container, state ) {
} }
function setupController( commentId, $link, mode, hideErrors ) { function setupController( commentId, $link, mode, hideErrors ) {
var commentController; var commentController, $addSectionLink;
if ( commentId === utils.NEW_TOPIC_COMMENT_ID ) { if ( commentId === utils.NEW_TOPIC_COMMENT_ID ) {
// eslint-disable-next-line no-jquery/no-global-selector
$addSectionLink = $( '#ca-addsection a' );
// When opening new topic tool using any link, always activate the link in page tabs too
$link = $link.add( $addSectionLink );
commentController = new NewTopicController( $pageContainer, parser ); commentController = new NewTopicController( $pageContainer, parser );
} else { } else {
commentController = new CommentController( $pageContainer, parser.findCommentById( commentId ), parser ); commentController = new CommentController( $pageContainer, parser.findCommentById( commentId ), parser );
@ -515,13 +519,9 @@ function init( $container, state ) {
} }
if ( storage.get( 'reply/' + utils.NEW_TOPIC_COMMENT_ID + '/saveable' ) ) { if ( storage.get( 'reply/' + utils.NEW_TOPIC_COMMENT_ID + '/saveable' ) ) {
mode = storage.get( 'reply/' + utils.NEW_TOPIC_COMMENT_ID + '/mode' ); mode = storage.get( 'reply/' + utils.NEW_TOPIC_COMMENT_ID + '/mode' );
// eslint-disable-next-line no-jquery/no-global-selector setupController( utils.NEW_TOPIC_COMMENT_ID, $( [] ), mode, true );
$link = $( '#ca-addsection a' );
setupController( utils.NEW_TOPIC_COMMENT_ID, $link, mode, true );
} else if ( mw.config.get( 'wgDiscussionToolsStartNewTopicTool' ) ) { } else if ( mw.config.get( 'wgDiscussionToolsStartNewTopicTool' ) ) {
// eslint-disable-next-line no-jquery/no-global-selector setupController( utils.NEW_TOPIC_COMMENT_ID, $( [] ) );
$link = $( '#ca-addsection a' );
setupController( utils.NEW_TOPIC_COMMENT_ID, $link );
} }
// For debugging (now unused in the code) // For debugging (now unused in the code)