filament-comments icon indicating copy to clipboard operation
filament-comments copied to clipboard

Support viewing comments as guest / prevent exceptions

Open SanderMuller opened this issue 8 months ago • 0 comments

This PR makes prevents the plugin from throwing exceptions when no user is logged in due to calling ->can() on null as part of the authz checks.

The PR has no impact on merge because the authz checks default to false. To actually render the comments for guests the developer has to override the ->visible() statement on the place of implementation, for example:

CommentsEntry::make('filament_comments')
    ->visible(fn (): bool => auth()->user()?->can('viewAny', config('filament-comments.comment_model')) ?? true),

SanderMuller avatar Apr 28 '25 14:04 SanderMuller