Skip to content

Commit fafe30f

Browse files
malbertsclaude
andcommitted
Fix RedHerbSidebarHook calling removed ViewHtmlBuilder method
`ViewHtmlBuilder::pageHasMainSubject()` was removed in #795 and the predicate moved to `PageSubjectsLookup`. The internal call site in `NeoWikiHooks` was updated, but `RedHerbSidebarHook` still referenced the removed method via the default closure in its constructor, which fired on every `SidebarBeforeOutput` invocation against an existing page, producing an HTTP 500. Switch the default closure to `PageSubjectsLookup::pageHasMainSubject()`, matching the call shape now used in `NeoWikiHooks::getNeoWikiAppHtml()`. The closure signature stays `Title -> bool`; the conversion to `PageId` is internal so existing test stubs need no changes. Follows-up to #795 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 850963e commit fafe30f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/RedHerb/src/RedHerbSidebarHook.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Closure;
88
use MediaWiki\Hook\SidebarBeforeOutputHook;
99
use MediaWiki\Title\Title;
10+
use ProfessionalWiki\NeoWiki\Domain\Page\PageId;
1011
use ProfessionalWiki\NeoWiki\NeoWikiExtension;
1112
use Skin;
1213

@@ -16,7 +17,8 @@ class RedHerbSidebarHook implements SidebarBeforeOutputHook {
1617

1718
public function __construct( ?Closure $pageHasMainSubject = null ) {
1819
$this->pageHasMainSubject = $pageHasMainSubject ?? static fn ( Title $title ): bool =>
19-
NeoWikiExtension::getInstance()->newViewHtmlBuilder()->pageHasMainSubject( $title );
20+
NeoWikiExtension::getInstance()->newPageSubjectsLookup()
21+
->pageHasMainSubject( new PageId( $title->getArticleID() ) );
2022
}
2123

2224
public function onSidebarBeforeOutput( $skin, &$sidebar ): void {

0 commit comments

Comments
 (0)