From 7fcaae95b730ee8ad596a065bcf0587b7c39feb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 5 Aug 2021 21:05:29 +0200 Subject: [PATCH] When opening new topic tool using any link, always activate the link in page tabs too Bug: T288267 Bug: T277371 Change-Id: I1854c82853abf16d9552765df983b4490fcd4b30 --- modules/controller.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/controller.js b/modules/controller.js index f2c336dc1..823b18840 100644 --- a/modules/controller.js +++ b/modules/controller.js @@ -403,8 +403,12 @@ function init( $container, state ) { } function setupController( commentId, $link, mode, hideErrors ) { - var commentController; + var commentController, $addSectionLink; 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 ); } else { commentController = new CommentController( $pageContainer, parser.findCommentById( commentId ), parser ); @@ -471,13 +475,9 @@ function init( $container, state ) { } if ( storage.get( 'reply/' + utils.NEW_TOPIC_COMMENT_ID + '/saveable' ) ) { mode = storage.get( 'reply/' + utils.NEW_TOPIC_COMMENT_ID + '/mode' ); - // eslint-disable-next-line no-jquery/no-global-selector - $link = $( '#ca-addsection a' ); - setupController( utils.NEW_TOPIC_COMMENT_ID, $link, mode, true ); + setupController( utils.NEW_TOPIC_COMMENT_ID, $( [] ), mode, true ); } else if ( mw.config.get( 'wgDiscussionToolsStartNewTopicTool' ) ) { - // eslint-disable-next-line no-jquery/no-global-selector - $link = $( '#ca-addsection a' ); - setupController( utils.NEW_TOPIC_COMMENT_ID, $link ); + setupController( utils.NEW_TOPIC_COMMENT_ID, $( [] ) ); } // For debugging (now unused in the code)