Avoid duplicating new topic tool if there are multiple .mw-parser-output elements

Bug: T337476
Change-Id: I581e4a584b3f18597e17f157478d9f4ade41c24e
This commit is contained in:
Bartosz Dziewoński 2023-05-25 15:03:35 +02:00
parent c28bcaaabd
commit 291808ff2b

View file

@ -73,7 +73,7 @@ NewTopicController.prototype.setup = function ( mode ) {
// Insert directly after the page content on already existing pages
// (.mw-parser-output is missing on non-existent pages)
var $parserOutput = this.$pageContainer.find( '.mw-parser-output' );
var $parserOutput = this.$pageContainer.find( '.mw-parser-output' ).first();
var $mobileAddTopicWrapper = this.$pageContainer.find( '.ext-discussiontools-init-new-topic' );
if ( $parserOutput.length ) {
$parserOutput.after( this.container.$element );