fix: honor disableSidebar() and hideSubscribers() on CommentsEntry#101
Open
ItsMalikJones wants to merge 1 commit into
Open
fix: honor disableSidebar() and hideSubscribers() on CommentsEntry#101ItsMalikJones wants to merge 1 commit into
ItsMalikJones wants to merge 1 commit into
Conversation
The notification sidebar kept showing despite ->disableSidebar(true) and ->hideSubscribers(true) because of two wiring bugs: - The Comments Livewire mountHasSidebar() hook expected a parameter named $enableSidebar, but every blade view passes the prop as `sidebar-enabled` (camelCased to `sidebarEnabled`). The mismatch meant the hook always fell back to the config default, clobbering disableSidebar(). - comments-entry.blade.php never passed :show-subscribers to the Comments component, so hideSubscribers() was dropped entirely on the infolist entry. Renames the hook parameter to $sidebarEnabled and threads :show-subscribers through the entry view (mirroring comments-modal.blade.php). Adds end-to-end coverage rendering the real CommentsEntry; this required registering Filament's Actions/Schemas/Infolists service providers in the test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #84.
The notification sidebar kept rendering on the infolist
CommentsEntryeven when->disableSidebar(true)or->hideSubscribers(true)was set. This PR fixes the two wiring bugs behind that and adds end-to-end test coverage.Problem
Two independent bugs caused the toggles to be silently ignored:
Mount-hook parameter mismatch. The
CommentsLivewire component'smountHasSidebar()hook expected a parameter named$enableSidebar, but every Blade view passes the prop as:sidebar-enabled— which Livewire camelCases tosidebarEnabled. The names never matched, so the hook always fell back to thecommentions.subscriptions.show_sidebarconfig default, clobberingdisableSidebar(). This affected both the infolist entry and the action modal.Missing prop on the entry view.
comments-entry.blade.phpnever passed:show-subscribersdown to theCommentscomponent, sohideSubscribers()was dropped entirely on the infolist entry. (comments-modal.blade.phpalready passed it correctly.)Changes
mountHasSidebar()parameter$enableSidebar→$sidebarEnabledinHasSidebarso it matches the prop name every Blade view actually passes.:show-subscribers="$showSubscribers()"throughcomments-entry.blade.php, mirroringcomments-modal.blade.php.tests/Filament/CommentsEntryTest.php— renders the realCommentsEntryinside a Filament schema and asserts both toggles take effect end-to-end.tests/Livewire/CommentsSubscriptionTest.php— adds coverage forshowSubscribersresolution and corrects a stale comment that described the bug as expected behavior.ActionsServiceProvider,SchemasServiceProvider, andInfolistsServiceProviderintests/TestCase.php, required to render the infolist entry under test.