Skip to content

fix: honor disableSidebar() and hideSubscribers() on CommentsEntry#101

Open
ItsMalikJones wants to merge 1 commit into
mainfrom
fix/84-sidebar-not-hiding
Open

fix: honor disableSidebar() and hideSubscribers() on CommentsEntry#101
ItsMalikJones wants to merge 1 commit into
mainfrom
fix/84-sidebar-not-hiding

Conversation

@ItsMalikJones
Copy link
Copy Markdown

Summary

Fixes #84.

The notification sidebar kept rendering on the infolist CommentsEntry even 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:

  1. Mount-hook parameter mismatch. The Comments Livewire component's mountHasSidebar() hook expected a parameter named $enableSidebar, but every Blade view passes the prop as :sidebar-enabled — which Livewire camelCases to sidebarEnabled. The names never matched, so the hook always fell back to the commentions.subscriptions.show_sidebar config default, clobbering disableSidebar(). This affected both the infolist entry and the action modal.

  2. Missing prop on the entry view. comments-entry.blade.php never passed :show-subscribers down to the Comments component, so hideSubscribers() was dropped entirely on the infolist entry. (comments-modal.blade.php already passed it correctly.)

Changes

  • Rename the mountHasSidebar() parameter $enableSidebar$sidebarEnabled in HasSidebar so it matches the prop name every Blade view actually passes.
  • Thread :show-subscribers="$showSubscribers()" through comments-entry.blade.php, mirroring comments-modal.blade.php.
  • Add tests:
    • tests/Filament/CommentsEntryTest.php — renders the real CommentsEntry inside a Filament schema and asserts both toggles take effect end-to-end.
    • tests/Livewire/CommentsSubscriptionTest.php — adds coverage for showSubscribers resolution and corrects a stale comment that described the bug as expected behavior.
  • Register Filament's ActionsServiceProvider, SchemasServiceProvider, and InfolistsServiceProvider in tests/TestCase.php, required to render the infolist entry under test.

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.
@ItsMalikJones ItsMalikJones self-assigned this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commentions Sidebar Still Appearing

1 participant