Page MenuHomePhabricator

New topic tool and topic subscriptions don't work when reply tool is disabled and the page would have reply links
Closed, ResolvedPublic

Description

New topic tool and topic subscriptions don't work (clicking the buttons does nothing) when reply tool is disabled and the page would have reply links.

Reported at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#c-Anomalocaris-20220809043500-Start_new_section_button,_in_editor's_talkpage.

Original report:

I have DT enabled, but Reply Tool disabled. This shows up at every page load.

var commentNodes = $pageContainer[0].querySelectorAll('[data-mw-comment]');

When Reply Tool is disabled, commentNodes here is populated only with .mw-headline nodes.

itemsById[id] in code cited in T314608#8132373 tries to access a comment by its ID prefixed with c-. itemsById has only IDs prefixed with h-, hence the error.

An exception is thrown when loading the page:

Uncaught TypeError: Cannot set properties of undefined (setting 'parent')
    at Array.map
    at ThreadItemSet.js.ThreadItemSet.static.newFromAnnotatedNodes
    at Object.init
    at mw.dt.init
    at Object.add
    at dt.init.js
    at runScript 
    at Array.<anonymous>
    at flushCssBuffer

Event Timeline

Change 820843 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] CommentFormatter: Set 'data-mw-comment' even when reply tool disabled

https://gerrit.wikimedia.org/r/820843

matmarex moved this task from Incoming to Code Review on the Editing-team (Kanban Board) board.
matmarex moved this task from Backlog to Triaged on the DiscussionTools board.

Actually, no other tools need to be enabled. DT checkboxes can be unchecked altogether on wikis where DT is enabled by default.

Jack_who_built_the_house renamed this task from "DiscussionTools: Cannot set properties of undefined (setting 'parent')" when reply tool disabled but other tools enabled to "DiscussionTools: Cannot set properties of undefined (setting 'parent')" when reply tool disabled but DT enabled.Aug 7 2022, 11:23 AM
matmarex renamed this task from "DiscussionTools: Cannot set properties of undefined (setting 'parent')" when reply tool disabled but DT enabled to "DiscussionTools: Cannot set properties of undefined (setting 'parent')" when reply tool disabled but DT enabled, and the page would have any reply links.Aug 10 2022, 8:05 PM

Also reported at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#c-Anomalocaris-20220809043500-Start_new_section_button,_in_editor's_talkpage.

This bug actually prevents the other discussion tools from working – I thought that the exception didn't have significant side-effects.

Change 820843 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] CommentFormatter: Set 'data-mw-comment' even when reply tool disabled

https://gerrit.wikimedia.org/r/820843

matmarex renamed this task from "DiscussionTools: Cannot set properties of undefined (setting 'parent')" when reply tool disabled but DT enabled, and the page would have any reply links to New topic tool and topic subscriptions don't work when reply tool is disabled and the page would have reply links.Aug 10 2022, 11:29 PM
matmarex updated the task description. (Show Details)

I will backport the fix tomorrow: https://wikitech.wikimedia.org/wiki/Deployments#deploycal-item-20220811T1300

Note that the affected pages will have to be edited or purged before the issue is resolved :(

Change 822149 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@wmf/1.39.0-wmf.23] CommentFormatter: Set 'data-mw-comment' even when reply tool disabled

https://gerrit.wikimedia.org/r/822149

Change 822149 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.39.0-wmf.23] CommentFormatter: Set 'data-mw-comment' even when reply tool disabled

https://gerrit.wikimedia.org/r/822149

Mentioned in SAL (#wikimedia-operations) [2022-08-11T14:10:14Z] <awight@deploy1002> Synchronized php-1.39.0-wmf.23/extensions/DiscussionTools/includes/CommentFormatter.php: Backport: [[gerrit:822149|CommentFormatter: Set 'data-mw-comment' even when reply tool disabled (T314707)]] (duration: 03m 31s)