NewTopicController: Fix tag list construction

Bug: T279157
Change-Id: I2fa8042878d0f24385a8528ef0ba26bd4689a387
This commit is contained in:
Ed Sanders 2021-05-03 18:42:16 +01:00
parent 9822a60757
commit b4f72b7516

View file

@ -130,14 +130,19 @@ NewTopicController.prototype.getUnsupportedNodeSelectors = function () {
NewTopicController.prototype.getApiQuery = function ( comment, pageName, checkboxes ) {
var data = NewTopicController.super.prototype.getApiQuery.call( this, comment, pageName, checkboxes );
// Rebuild the tags array and remove the reply tag
var tags = ( data.dttags || '' ).split( ',' );
var replyTag = tags.indexOf( 'discussiontools-reply' );
if ( replyTag !== -1 ) {
tags.splice( replyTag, 1 );
}
// Add the newtopic tag
tags.push( 'discussiontools-newtopic' );
data = $.extend( {}, data, {
paction: 'addtopic',
sectiontitle: this.sectionTitle.getValue(),
dttags: [
'discussiontools',
'discussiontools-newtopic',
'discussiontools-' + this.replyWidget.getMode()
].join( ',' )
dttags: tags.join( ',' )
} );
return data;