[IP-18]: User pages in the Core Module#595
Conversation
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
Modules/Core/Tests/Feature/UserProfileTest.php (1)
15-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
#[Group]attributes and align method names withit_<verb>_<subject>convention.Three test methods don't follow the
it_<verb>_<subject>naming pattern required by the coding guidelines, and no#[Group]attributes are present on the class or methods. As per coding guidelines: "Use#[Group('smoke|crud|security|authentication|...')]attribute to organize tests by group" and "Use snake_case method names in tests following the patternit_<verb>_<subject>".♻️ Proposed naming and group fixes
#[CoversClass(EditProfile::class)] #[CoversClass(MyCompanies::class)] +#[Group('crud')] class UserProfileTest extends AbstractCompanyPanelTestCase- public function password_change_requires_matching_confirmation(): void + public function it_requires_matching_password_confirmation(): void- public function the_company_list_renders_for_the_authenticated_user(): void + public function it_renders_the_company_list_for_the_authenticated_user(): void- public function switching_sets_the_tenant_and_redirects_to_the_target_dashboard(): void + public function it_sets_the_tenant_and_redirects_on_company_switch(): voidAlso applies to: 52-52, 83-83, 93-93
🤖 Prompt for 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. In `@Modules/Core/Tests/Feature/UserProfileTest.php` around lines 15 - 17, Add #[Group(...)] attributes to UserProfileTest and/or its test methods to organize these tests using the appropriate existing group categories, then rename the three nonconforming test methods to snake_case names following the it_<verb>_<subject> convention. Preserve each test’s behavior and choose groups matching the scenarios covered by the methods.Source: Coding guidelines
🤖 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 `@Modules/Core/Filament/Company/Pages/Auth/EditProfile.php`:
- Around line 106-107: Replace the __() calls used for the password field label
and validationAttribute in the EditProfile form with trans(), preserving the
existing translation keys and field configuration.
- Around line 89-92: Update the email handling condition around
sendEmailChangeVerification() to require that $data['email'] differs from
$record->email, while retaining the existing feature flag and array_key_exists
checks. Continue unsetting email after processing so unchanged addresses are not
verified or persisted as email changes.
In `@Modules/Core/Services/UserService.php`:
- Around line 92-112: Update UserService::updateAvatar to retain the existing
avatar reference, replace the Upload record, and delete the previous stored
object only after a successful replacement. Add a clear/remove path for an empty
avatar that deletes the existing Upload and its file. In
EditProfile::handleRecordUpdate, treat an empty avatar as removal rather than no
change, and add regression coverage for both replacement and clearing, including
database and storage cleanup.
In `@public/build/manifest.json`:
- Line 3: Ensure the generated hashed CSS/JS assets referenced by
public/build/manifest.json are present under public/build by committing the
build outputs or regenerating the manifest to match the available files. Verify
all seven manifest entries resolve to existing assets and avoid leaving
references that produce 404 responses.
In `@public/storage`:
- Line 1: Remove the environment-specific absolute symlink at public/storage.
Leave public/storage absent from the committed repository and rely on deployment
to create it with php artisan storage:link, or replace it with a portable
relative symlink that preserves public access to storage/app/public.
---
Nitpick comments:
In `@Modules/Core/Tests/Feature/UserProfileTest.php`:
- Around line 15-17: Add #[Group(...)] attributes to UserProfileTest and/or its
test methods to organize these tests using the appropriate existing group
categories, then rename the three nonconforming test methods to snake_case names
following the it_<verb>_<subject> convention. Preserve each test’s behavior and
choose groups matching the scenarios covered by the methods.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: ff625dd1-2420-4505-9d38-4055566a1d03
📒 Files selected for processing (20)
Modules/Core/Database/Migrations/2026_07_13_000000_add_language_to_users_table.phpModules/Core/Filament/Company/Pages/Auth/EditProfile.phpModules/Core/Filament/Company/Pages/MyCompanies.phpModules/Core/Models/User.phpModules/Core/Providers/CompanyPanelProvider.phpModules/Core/Services/UserService.phpModules/Core/Tests/AbstractCompanyPanelTestCase.phpModules/Core/Tests/Feature/UserProfileTest.phpModules/Core/resources/views/filament/admin/pages/settings.blade.phpModules/Core/resources/views/filament/company/pages/my-companies.blade.phppublic/build/assets/app-BA_uZO_d.csspublic/build/assets/app-f1GSCnwV.jspublic/build/assets/invoiceplane-BRKoI_Ls.csspublic/build/assets/invoiceplane-blue-DySqjbYI.csspublic/build/assets/nord-DE5VcrRz.csspublic/build/assets/orange-CttdIaNv.csspublic/build/assets/reddit-BXTru7AK.csspublic/build/manifest.jsonpublic/storageresources/lang/en/ip.php
💤 Files with no reviewable changes (1)
- public/build/assets/app-f1GSCnwV.js
Build outputs are already gitignored via /public/build/, but this file was force-added in an earlier commit. Keeping it tracked let it drift out of sync with the (untracked) hashed assets it references, risking 404s on any checkout that hasn't run `yarn build` yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The committed symlink pointed to an absolute, machine-specific path (/var/www/InvoicePlane-v2/...), breaking on every other checkout. Deployments should create it via `php artisan storage:link` instead. Also fix the .gitignore pattern (drop trailing slash) since it only matched directories and never actually caught the symlink, which is how it got force-committed in the first place. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pull Request Checklist
Checklist
Description
Adds two self-service pages to the Company panel:
/{tenant}/my-profile) — lets a logged-in user update their name, email (with re-verification), password, language, and avatar./{tenant}/my-companies) — lists every company the user belongs to (name, search code, role) with a "Switch" action that sets the Filament tenant and redirects to that company's dashboard.Implementation notes / deviations from the original spec, driven by the actual schema:
usershas a singlenamecolumn, notfirst_name/last_name— the form andUserService::updateProfile()usename.languagecolumn tousersvia migration (the existinguser_profiles.user_languagecolumn is dead code with a brokencompany_idglobal scope, so it wasn't reused).Uploadmodel (uploadablemorph) via a newUser::avatarUpload()relation;User::getFilamentAvatarUrl()now falls back to the previously-unusedProfileImageFactory/Gravatar driver when no avatar is set.password_confirmation(from Filament's defaultpasswordConfirmation) to match Laravel convention and the ticket's test scenarios.EditProfileis registered as a normal tenant-scoped page rather than through Filament's->profile()panel method —->profile()registers routes outside the tenant route group, which broke sidebar navigation (UrlGenerationException: Missing required parameter: tenant) the moment the page had a link pointing to it. See fix commit for the route-registration override.->emailChangeVerification()on the Company panel, which was previously never turned on despite->emailVerification()being set — without it, changing email would have silently saved the new address with no re-verification step.AbstractCompanyPanelTestCase::testLivewire()called a non-existentwithSession()method (dead code, unused until this PR's tests exercised it), andModules/Core/resources/views/filament/admin/pages/settings.blade.phpused internal Filament schema-component views (x-filament-schemas::form/::actions) directly instead of the standalone<form>/<x-filament::actions>equivalents, which throws once the compiled view cache is cleared.Related Issue(s)
Closes #18
Motivation and Context
Users currently have no way to update their own name/email/password/avatar or see which companies they belong to without admin intervention. This adds that self-service capability to the Company panel.
Issue Type (Check one or more)
Screenshots
Edit Profile
My Companies
Summary by CodeRabbit
New Features
Bug Fixes
Translations