Skip to content

Conversation

@rmartinoscar
Copy link
Member

Those were added after #1768

@coderabbitai
Copy link

coderabbitai bot commented Oct 26, 2025

📝 Walkthrough

Walkthrough

Three files updated to replace auth()->user() calls with the user() helper function. Two implementations also adopt null-safe checks to handle unauthenticated requests without throwing errors.

Changes

Cohort / File(s) Summary
Simple auth user replacement
app/Filament/Admin/Resources/Users/UserResource.php
Changed actor source for user:ssh-key.delete activity log from auth()->user() to user()
Null-safe auth user replacement
app/Filament/Server/Pages/Startup.php
Changed access check from auth()->user()->can(...) to null-safe !user()?->can(...) for Startup command selection
Null-safe auth user replacement
app/Models/ActivityLog.php
Replaced auth()->user()->can(...) with optional null-safe user()?->can(...) check; returns null if no user exists or lacks permission

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The description "Those were added after #1768" is extremely vague and uses a non-descriptive term ("Those") that does not meaningfully convey what the changeset actually does. While it provides historical context by referencing a related PR, it fails to explain the purpose or nature of the changes in this PR. The description does not help readers understand that this involves refactoring code to use the user() helper function instead of auth()->user().
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Leverage user() helper" directly corresponds to the main change in the pull request. All three modified files follow the same pattern: replacing direct calls to auth()->user() with the user() helper function, making the code more consistent and null-safe. The title is concise, clear, and accurately captures the core refactoring purpose that a developer reviewing the history would immediately understand.

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6bd6e4 and d2b5d0a.

📒 Files selected for processing (3)
  • app/Filament/Admin/Resources/Users/UserResource.php (1 hunks)
  • app/Filament/Server/Pages/Startup.php (1 hunks)
  • app/Models/ActivityLog.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
app/Models/ActivityLog.php (2)
app/helpers.php (1)
  • user (127-130)
app/Models/User.php (1)
  • can (357-370)
app/Filament/Admin/Resources/Users/UserResource.php (2)
app/Models/ActivityLog.php (1)
  • actor (93-96)
app/helpers.php (1)
  • user (127-130)
app/Filament/Server/Pages/Startup.php (3)
app/helpers.php (1)
  • user (127-130)
app/Models/User.php (1)
  • can (357-370)
app/Models/Permission.php (1)
  • Permission (11-221)
🔇 Additional comments (2)
app/Models/ActivityLog.php (1)

168-168: LGTM! Proper null-safe check.

The change from auth()->user()->can(...) to user()?->can(...) correctly handles the case where no user is authenticated, preventing potential null reference errors while maintaining the intended logic.

app/Filament/Server/Pages/Startup.php (1)

54-54: LGTM! Consistent with existing patterns.

The change from auth()->user()->can(...) to user()?->can(...) properly handles unauthenticated scenarios and aligns with the null-safe pattern already used throughout this file (lines 88, 126, 142, 147).

@rmartinoscar rmartinoscar merged commit 3bcdeea into main Oct 26, 2025
25 checks passed
@rmartinoscar rmartinoscar deleted the chore/userHelper branch October 26, 2025 15:24
@github-actions github-actions bot locked and limited conversation to collaborators Oct 26, 2025
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.

4 participants