feat(home+auth): external-link rel safety + organizationSetup error alert#4237
Conversation
…om trawl T8: add buttonTarget/buttonRel computed props to home.content.component.vue — auto-applies target=_blank + rel=noopener noreferrer for external links T9: add user-visible error alert to organizationSetup.component.vue — replaces console.error with v-alert on createOrganization failure Closes #4236. Partially closes pierreb-projects/infra#38 (T8+T9).
|
Warning Review limit reached
More reviews will be available in 58 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4237 +/- ##
=======================================
Coverage 99.56% 99.56%
=======================================
Files 31 31
Lines 1162 1162
Branches 329 329
=======================================
Hits 1157 1157
Misses 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR promotes two UX improvements into the devkit: safer handling of external links rendered by the home content utility component, and a user-visible error alert when organization creation fails during auth onboarding (drift cleanup tasks T8 + T9).
Changes:
- Add
buttonTarget/buttonRelcomputed props to automatically applytarget="_blank"+rel="noopener noreferrer"for externalhttp(s)button links inHomeContentComponent. - Replace the silent
console.errorbehavior on organization creation failure with a dismissible<v-alert type="error">surfaced in the org setup UI. - Add/extend unit tests covering the new computed props and org-setup error state.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/modules/home/components/utils/home.content.component.vue | Adds computed target/rel and binds them to the button for external-link safety. |
| src/modules/home/tests/home.content.component.unit.tests.js | Adds unit tests for the new buttonTarget / buttonRel behavior. |
| src/modules/auth/components/organizationSetup.component.vue | Adds an error state + error alert for failed org creation and clears error on submit. |
| src/modules/auth/tests/auth.organizationSetup.component.unit.tests.js | Adds tests for the new error state behavior on failures and retries. |
| buttonTarget() { | ||
| const explicit = this.setup.button?.target; | ||
| if (explicit) return explicit; | ||
| const link = this.setup.button?.link || ''; | ||
| return /^https?:\/\//i.test(link) ? '_blank' : null; | ||
| }, |
| buttonRel() { | ||
| return this.buttonTarget === '_blank' ? 'noopener noreferrer' : null; | ||
| }, |
| if (!form.valid) return; | ||
|
|
||
| this.loading = true; | ||
| this.error = null; |
| it('buttonTarget returns _blank for an external https link', () => { | ||
| const wrapper = mount(HomeContentComponent, { | ||
| props: { setup: { ...baseSetup, button: { title: 'Go', link: 'https://example.com' } } }, | ||
| global: globalOpts(vuetify), | ||
| }); | ||
| expect(wrapper.vm.buttonTarget).toBe('_blank'); | ||
| }); |
| it('sets error from response data message on createOrganization failure', async () => { | ||
| const apiError = { response: { data: { message: 'Name already taken' } } }; | ||
| createOrganizationMock.mockRejectedValueOnce(apiError); | ||
|
|
||
| const wrapper = mountComponent(); | ||
| await flushPromises(); | ||
|
|
||
| wrapper.vm.organizationName = 'Duplicate Org'; | ||
| await wrapper.vm.submit(); | ||
|
|
||
| expect(wrapper.vm.error).toBe('Name already taken'); | ||
| }); |
Summary
Promotes two generic UX improvements from
trawl_vuedownstream back to the devkit. Part of the drift cleanup audit (infra#38, Tasks T8 + T9).T8 — External-link safety (
home.content.component.vue): addsbuttonTargetandbuttonRelcomputed props that auto-applytarget="_blank"+rel="noopener noreferrer"wheneversetup.button.linkis an external URL. An explicitsetup.button.targetoverride is respected. Bindings added to the<v-btn>element.T9 — Org-setup error alert (
organizationSetup.component.vue): replaces the silentconsole.erroroncreateOrganizationfailure with a dismissiblev-alert type="error" variant="tonal"that surfaceserr.response.data.message,err.message, or a generic fallback. Addserror: nulltodata()and clears it at the start of each submit.Unit tests added for both (6 new for T8, 5 new for T9 — all green).
Closes
Test plan
npm run lint— no issuesnpm run test:unit— 29 tests pass in the two modified test files (pre-existing unrelated failures inapp.router/legal.routertests not introduced by this PR)