Skip to content

Support viewing comments as guest / prevent exceptions #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SanderMuller
Copy link

@SanderMuller SanderMuller commented Apr 28, 2025

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),

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.

1 participant