From c17a0763825d590824b07ca031a56f384830414b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 18 Nov 2020 19:19:06 +0100 Subject: [PATCH] Fix displaying reply links after posting a reply with dtenable=1 Bug: T267847 Change-Id: Ifb59cb942b673d9abcab563e6bc27fa1f6d5e9d7 --- includes/Hooks.php | 4 ++++ modules/CommentController.js | 3 +++ modules/controller.js | 3 +++ 3 files changed, 10 insertions(+) diff --git a/includes/Hooks.php b/includes/Hooks.php index 0f309faf4..80aca4ba5 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -79,6 +79,10 @@ class Hooks { if ( $output->getRequest()->getVal( 'dtenable' ) ) { return true; } + // Extra hack for parses from API, where this parameter isn't passed to derivative requests + if ( RequestContext::getMain()->getRequest()->getVal( 'dtenable' ) ) { + return true; + } $user = $output->getUser(); $services = MediaWikiServices::getInstance(); diff --git a/modules/CommentController.js b/modules/CommentController.js index d809df640..a49b0265f 100644 --- a/modules/CommentController.js +++ b/modules/CommentController.js @@ -252,6 +252,9 @@ CommentController.prototype.save = function ( comment, pageName ) { assert: mw.user.isAnon() ? 'anon' : 'user', assertuser: mw.user.getName() || undefined, uselang: mw.config.get( 'wgUserLanguage' ), + // HACK: Always display reply links afterwards, ignoring preferences etc., in case this was + // a page view with reply links forced with ?dtenable=1 or otherwise + dtenable: '1', dttags: [ 'discussiontools', 'discussiontools-reply', diff --git a/modules/controller.js b/modules/controller.js index 50fd9311f..fe115195e 100644 --- a/modules/controller.js +++ b/modules/controller.js @@ -307,6 +307,9 @@ function update( data, comment, pageName, replyWidget ) { // adding our reply links in the HTML (T266195) useskin: mw.config.get( 'skin' ), uselang: mw.config.get( 'wgUserLanguage' ), + // HACK: Always display reply links afterwards, ignoring preferences etc., in case this was + // a page view with reply links forced with ?dtenable=1 or otherwise + dtenable: '1', prop: [ 'text', 'modules', 'jsconfigvars' ], page: mw.config.get( 'wgRelevantPageName' ) } );