Add user filter to activity logs page - #2475
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe activity table gains a tenant-scoped ChangesActivity filtering
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Filament/Server/Resources/Activities/ActivityResource.php`:
- Around line 141-145: Update the activity options closure in ActivityResource
to use the same visibility-constrained query as getEloquentQuery(), including
disabled-event filtering and conditional root-admin exclusion. Reuse or extract
the shared query/scope so the dropdown only includes actors present in the
filtered activity results, then pluck actor usernames and IDs from that
constrained relation.
- Around line 139-145: Constrain the actor filter in ActivityResource’s actor_id
options/query to User actors only, matching the actor_type restriction already
applied by getEloquentQuery(). Ensure selected users cannot match non-User
polymorphic activity records by filtering actor_type or using the User
relationship, while preserving the existing username/id option values.
- Around line 141-148: Update the options callback for the actor select in
ActivityResource to query unique actors directly instead of calling get() on the
full activity relationship. Join the users table through the activity logs’
actor/subject relationship as needed, select distinct activity_logs.actor_id and
users.username, and return the resulting username-to-ID mapping while preserving
the existing tenant scoping.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c16166d-2a27-4466-b1e1-0fb044d0053e
📒 Files selected for processing (1)
app/Filament/Server/Resources/Activities/ActivityResource.php
No filter:

With filter:
