From aa239a1ad1e3770408ff1e2b698600bcc2700b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 22 Jun 2023 10:24:42 +0200 Subject: [PATCH] Suppress the empty state in previews again It wasn't appearing in normal previews thanks to some redundant checks elsewhere, but it was appearing in our own internal previews using ApiDiscussionToolsTrait::previewMessage(). It wasn't causing any problems until change Iac3778a4a88a4def234be9d10b80d9796d35bceb, which detects headings in the preview, and it was detecting the empty state heading. Follow-up to commits 8fb467896ff673aee045ca64d229e5cbc16a31a7 and ab40ef62c08fe375ea04b254e4df0a28c295544f, where I replaced a HTML comment with ParserOutput extension data to indicate this, and then accidentally removed the cleanup code from removeInteractiveTools() with no replacement. Change-Id: I4b650f82c711d65e200758e981ce338202deeaa6 --- includes/Hooks/ParserHooks.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/Hooks/ParserHooks.php b/includes/Hooks/ParserHooks.php index 6d6f87dd9..10628b447 100644 --- a/includes/Hooks/ParserHooks.php +++ b/includes/Hooks/ParserHooks.php @@ -69,6 +69,8 @@ class ParserHooks implements if ( $parser->getOptions()->getIsPreview() ) { $text = CommentFormatter::removeInteractiveTools( $text ); + // Suppress the empty state + $pout->setExtensionData( 'DiscussionTools-isEmptyTalkPage', null ); } $pout->addModuleStyles( [