From 4399d9a458c7d4988c52b5faed9b254b856b1b45 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Fri, 20 Sep 2024 14:36:17 -0400 Subject: [PATCH] Always set a value for isEmptyTalkPage when transforming html For interface messages, like the talk page header, tranformHtml isn't run so no value is set while parsing it. The double negative in I5c1877f7f9eb73f88a33e001ca3c2f3d06bb90e4 failed to account for that and was reverted in I23a3f937201d93c7c7645a09c4fccfcf1c14008a. By always setting a value, we'll overwrite a value that may have been set when Parsoid calls the legacy parser to parse extension content for which it doesn't have a native extension, which then gets merged into the metadata for the main parse. However, setting with a different value is deprecated and will eventually throw, but we already need to find a solution for T372592 so what's one more. Bug: T371125 Bug: T372592 Change-Id: Id73a1b5751cfc055e84188bcb19583c72b84032f --- includes/CommentFormatter.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/CommentFormatter.php b/includes/CommentFormatter.php index d41260caa..b23ccd442 100644 --- a/includes/CommentFormatter.php +++ b/includes/CommentFormatter.php @@ -410,9 +410,12 @@ class CommentFormatter { ->addTrackingCategory( $pout, 'discussiontools-comments-before-first-heading-category', $title ); } - if ( count( $threadItems ) === 0 ) { - $pout->setExtensionData( 'DiscussionTools-isEmptyTalkPage', true ); - } + // FIXME: Similar to `setJsConfigVar` below, this will eventually throw + // from Parsoid's calls to the legacy parser for extension content parsing + $pout->setExtensionData( + 'DiscussionTools-isEmptyTalkPage', + count( $threadItems ) === 0 + ); $threadsJSON = array_map( static function ( ContentThreadItem $item ) { return $item->jsonSerialize( true );