mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-30 19:16:39 +00:00
Merge "Revert "Invert logic on empty talk page""
This commit is contained in:
commit
f57ee98ee8
|
@ -410,8 +410,8 @@ class CommentFormatter {
|
||||||
->addTrackingCategory( $pout, 'discussiontools-comments-before-first-heading-category', $title );
|
->addTrackingCategory( $pout, 'discussiontools-comments-before-first-heading-category', $title );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( count( $threadItems ) > 0 ) {
|
if ( count( $threadItems ) === 0 ) {
|
||||||
$pout->setExtensionData( 'DiscussionTools-isNotEmptyTalkPage', true );
|
$pout->setExtensionData( 'DiscussionTools-isEmptyTalkPage', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
$threadsJSON = array_map( static function ( ContentThreadItem $item ) {
|
$threadsJSON = array_map( static function ( ContentThreadItem $item ) {
|
||||||
|
@ -926,7 +926,7 @@ class CommentFormatter {
|
||||||
* HookUtils::shouldDisplayEmptyState which assures we have a talk page.
|
* HookUtils::shouldDisplayEmptyState which assures we have a talk page.
|
||||||
*/
|
*/
|
||||||
public static function isEmptyTalkPage( ParserOutput $pout ): bool {
|
public static function isEmptyTalkPage( ParserOutput $pout ): bool {
|
||||||
return $pout->getExtensionData( 'DiscussionTools-isNotEmptyTalkPage' ) !== true;
|
return $pout->getExtensionData( 'DiscussionTools-isEmptyTalkPage' ) === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,7 +72,7 @@ class ParserHooks implements
|
||||||
if ( $isPreview ) {
|
if ( $isPreview ) {
|
||||||
$html = CommentFormatter::removeInteractiveTools( $html );
|
$html = CommentFormatter::removeInteractiveTools( $html );
|
||||||
// Suppress the empty state
|
// Suppress the empty state
|
||||||
$pout->setExtensionData( 'DiscussionTools-isNotEmptyTalkPage', true );
|
$pout->setExtensionData( 'DiscussionTools-isEmptyTalkPage', null );
|
||||||
}
|
}
|
||||||
|
|
||||||
$pout->addModuleStyles( [ 'ext.discussionTools.init.styles' ] );
|
$pout->addModuleStyles( [ 'ext.discussionTools.init.styles' ] );
|
||||||
|
|
|
@ -95,8 +95,8 @@ class CommentFormatterTest extends IntegrationTestCase {
|
||||||
"hasLedeContent\n" : '' ) .
|
"hasLedeContent\n" : '' ) .
|
||||||
( $pout->getExtensionData( 'DiscussionTools-hasCommentsInLedeContent' ) ?
|
( $pout->getExtensionData( 'DiscussionTools-hasCommentsInLedeContent' ) ?
|
||||||
"hasCommentsInLedeContent\n" : '' ) .
|
"hasCommentsInLedeContent\n" : '' ) .
|
||||||
( $pout->getExtensionData( 'DiscussionTools-isNotEmptyTalkPage' ) ?
|
( $pout->getExtensionData( 'DiscussionTools-isEmptyTalkPage' ) ?
|
||||||
'' : "isEmptyTalkPage\n" ) .
|
"isEmptyTalkPage\n" : '' ) .
|
||||||
FormatJson::encode( $pout->getJsConfigVars(), "\t", FormatJson::ALL_OK ) .
|
FormatJson::encode( $pout->getJsConfigVars(), "\t", FormatJson::ALL_OK ) .
|
||||||
"\n</pre>";
|
"\n</pre>";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue