Page MenuHomePhabricator

Parse API requests with talk pages in `title` parameter include extraneous code
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

new mw.Api().post({
  action: 'parse',
  format: 'json',
  formatversion: 2,
  text: 'text',
  contentmodel: 'wikitext',
  prop: 'text',
  disablelimitreport: true,
  title: 'Talk:Mall De Goa',
}).then(console.log)

What happens?:
The result contains the parsed text, and then DiscussionTools' placeholder from T270323/T256480.

"<div class="mw-parser-output"><p>text
</p><div class="ext-discussiontools-emptystate"><div class="ext-discussiontools-emptystate-text"><h3>Start a discussion about improving the Mall De Goa page</h3><div class="plainlinks"><p><a href="/wiki/Help:Introduction_to_talk_pages/1" title="Help:Introduction to talk pages/1">Talk pages</a> are where people discuss how to make content on Wikipedia the best that it can be. You can use this page to start a discussion with others about how to improve the "<a href="/wiki/Mall_De_Goa" title="Mall De Goa">Mall De Goa</a>" page.
</p></div><span class='oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-flaggedElement-progressive oo-ui-buttonWidget'><a role='button' tabindex='0' href='/w/index.php?title=Talk:Mall_De_Goa&amp;action=edit&amp;section=new' rel='nofollow' class='oo-ui-buttonElement-button'><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon oo-ui-image-invert'></span><span class='oo-ui-labelElement-label'>Start a discussion</span><span class='oo-ui-indicatorElement-indicator oo-ui-indicatorElement-noIndicator oo-ui-image-invert'></span></a></span></div><img src="/w/extensions/DiscussionTools/images/emptystate.svg" class="ext-discussiontools-emptystate-logo" alt=""/></div></div>"

image.png (1,072×226 px, 32 KB)

What should have happened instead?:
I believe it shouldn't be there.

Event Timeline

I'm not convinced that it shouldn't appear. This is the same API that we use to display the page after saving (e.g. in 2017WTE), and for that use case, it seems natural for me to include this.

You can hide it by using preview: 1 in your API request, because we hide this part of the interface in previews (and I'm guessing that you're probably using this to preview a new comment, or something like that).

See also similar discussion on T314623.

I stand by what I said there.

I would not expect the banner to be in the parsed output since action=parse is meant to parse the content (wikitext) of the page, and the banner is not present in the wikitext.