Skip to content

Add user filter to activity logs page - #2475

Merged
Boy132 merged 2 commits into
mainfrom
boy132/activity-user-filter
Jul 27, 2026
Merged

Add user filter to activity logs page#2475
Boy132 merged 2 commits into
mainfrom
boy132/activity-user-filter

Conversation

@Boy132

@Boy132 Boy132 commented Jul 27, 2026

Copy link
Copy Markdown
Member

No filter:
grafik

With filter:
grafik

@Boy132 Boy132 self-assigned this Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8435f49b-74da-4161-9ddc-dac9b79bcd59

📥 Commits

Reviewing files that changed from the base of the PR and between 8108977 and a49c628.

📒 Files selected for processing (1)
  • app/Filament/Server/Resources/Activities/ActivityResource.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/Filament/Server/Resources/Activities/ActivityResource.php

📝 Walkthrough

Walkthrough

The activity table gains a tenant-scoped actor_id select filter. Its options use actor usernames keyed by actor IDs, and the filter supports searching and preloading.

Changes

Activity filtering

Layer / File(s) Summary
Actor filter configuration
app/Filament/Server/Resources/Activities/ActivityResource.php
Adds a searchable, preloaded actor_id filter labeled with the activity user translation and populated from tenant-related actors.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a user filter to the activity logs page.
Description check ✅ Passed The description is directly related to the change and shows the new filter in the activity logs UI.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f68b895 and 8108977.

📒 Files selected for processing (1)
  • app/Filament/Server/Resources/Activities/ActivityResource.php

Comment thread app/Filament/Server/Resources/Activities/ActivityResource.php Outdated
Comment thread app/Filament/Server/Resources/Activities/ActivityResource.php Outdated
Comment thread app/Filament/Server/Resources/Activities/ActivityResource.php Outdated
@Boy132
Boy132 merged commit 3eaa09e into main Jul 27, 2026
16 checks passed
@Boy132
Boy132 deleted the boy132/activity-user-filter branch July 27, 2026 17:21
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants