Allow to add translation prefix to custom subuser permissions#2265
Allow to add translation prefix to custom subuser permissions#2265
Conversation
📝 WalkthroughWalkthroughAdds dynamic, prefix-based translation key handling for subuser permission labels/descriptions and extends the Subuser model to register and emit a translation_prefix for permission groups; also adds many English permission translation entries. Changes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/Models/Subuser.php`:
- Line 41: The new parameter $translationPrefix was inserted as the 3rd
positional argument in Subuser::registerCustomPermissions which shifts $icon and
$hidden and breaks existing callers; restore backward compatibility by moving
$translationPrefix to the end of the parameter list (e.g. keep
registerCustomPermissions(string $name, array $permissions,
null|string|BackedEnum $icon = null, ?bool $hidden = null, ?string
$translationPrefix = null)), update the method signature in
Subuser::registerCustomPermissions and any internal calls accordingly so
existing positional calls continue to work.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/Filament/Server/Resources/Subusers/SubuserResource.phpapp/Models/Subuser.phplang/en/server/user.php
…ubuser-permissions
There was a problem hiding this comment.
♻️ Duplicate comments (1)
app/Models/Subuser.php (1)
52-52:⚠️ Potential issue | 🟠 MajorPublic API break from inserted positional parameter.
Line 52 inserts
$translationPrefixbefore$iconand$hidden, which breaks existing positional calls toregisterCustomPermissions(...)(including potential enum icon callers). This is the same unresolved compatibility issue previously flagged.💡 Backward-compatible signature adjustment
- public static function registerCustomPermissions(string $name, array $permissions, ?string $translationPrefix = null, null|string|BackedEnum $icon = null, ?bool $hidden = null): void + public static function registerCustomPermissions(string $name, array $permissions, null|string|BackedEnum $icon = null, ?bool $hidden = null, ?string $translationPrefix = null): void🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/Models/Subuser.php` at line 52, The new positional parameter breaks the public API of Subuser::registerCustomPermissions; revert to a backward-compatible signature by moving $translationPrefix to the end as an optional parameter (keep types: string|null and existing union for $icon: null|string|BackedEnum) so existing callers using positional $icon/$hidden continue to work; update the function declaration for registerCustomPermissions and adjust internal usages to read the moved parameter, and add a short docblock/deprecation note if desired for the old ordering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@app/Models/Subuser.php`:
- Line 52: The new positional parameter breaks the public API of
Subuser::registerCustomPermissions; revert to a backward-compatible signature by
moving $translationPrefix to the end as an optional parameter (keep types:
string|null and existing union for $icon: null|string|BackedEnum) so existing
callers using positional $icon/$hidden continue to work; update the function
declaration for registerCustomPermissions and adjust internal usages to read the
moved parameter, and add a short docblock/deprecation note if desired for the
old ordering.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 964b3566-3535-478d-92c4-255f7d462e09
📒 Files selected for processing (1)
app/Models/Subuser.php
Closes #2069
Supersedes #2185