List of steps to reproduce
Use API:Parse to preview some wikitext containing a comment, with parameters pst=true and title=Talk:API (or any talk/discussion page).
For instance, enter the following in JS console:
(await new mw.Api().get({ action: 'parse', prop: 'text', pst: true, text: "Hi. ~~~~", title: 'Talk:API', disablelimitreport: true, formatversion: 2, })).parse.text
Actual behaviour:
Irrespective of whether DiscussionTools is enabled or disabled, output looks something like this:
Hi. SD0001 (talk) 16:43, 2 October 2021 (UTC) [ ]
There's a stray pair of brackets appear at the end, with no reply button between them. Associated html:
<span class="ext-discussiontools-init-replylink-buttons"><span class="ext-discussiontools-init-replylink-bracket">[</span><a class="ext-discussiontools-init-replylink-reply" role="button" tabindex="0" data-mw-comment="{"type":"comment","level":1,"id":"c-SD0001-2021-10-02T16:43:00.000Z","replies":[],"timestamp":"2021-10-02T16:43:00.000Z","author":"SD0001"}" href=""><!--__DTREPLY__--></a><span class="ext-discussiontools-init-replylink-bracket">]</span></span>
Expected behaviour
Either the reply button should be added properly or shouldn't be added at all.