Skip to content

Save the autofilled site logo as the workspace logo on brand settings update#173

Merged
paulocastellano merged 2 commits into
mainfrom
fix/autofill-save-logo
Jul 3, 2026
Merged

Save the autofilled site logo as the workspace logo on brand settings update#173
paulocastellano merged 2 commits into
mainfrom
fix/autofill-save-logo

Conversation

@paulocastellano

Copy link
Copy Markdown
Contributor

Problem

On the workspace Brand settings page, running brand autofill from the site URL already fetches the site's logo and shows a preview beneath the URL — but saving the form never persisted that logo as the workspace logo. The logo silently disappeared on submit.

The create flow (store) handled this correctly via LogoAttacher; the update flow (updateSettings) was missing all three legs of the same wiring.

Fix

Mirror the store flow across the three places the logo needs to travel:

  • BrandTab.vue — add logo_url to the useForm payload so BrandForm's autofill sets it and the form actually submits it.
  • UpdateWorkspaceRequest — validate logo_url (nullable, url, max:1024). FormRequest::validated() strips any key without a rule, so without this the field was dropped before the controller ever saw it (the same silent-drop gotcha documented for platform meta).
  • WorkspaceController::updateSettings — pull logo_url out of the validated data (it is not a column) and attach it through LogoAttacher, wrapped in the same try/catch + Log::warning as store.

Tests

tests/Feature/WorkspaceControllerTest.php:

  • update settings attaches the autofilled logo when logo_url is provided
  • update settings does not touch the logo when no logo_url is provided

Both mutation-tested (removing the request rule / the attach call makes them fail). Full suite green.

… update

Brand autofill on the workspace settings page already captured the site logo
and rendered a preview beneath the URL, but the update flow never persisted it.
The store flow attached it via LogoAttacher; the update flow was missing all
three legs: the form field, the request rule, and the controller attach.

- BrandTab: add logo_url to the useForm payload so autofill can set it and the
  form submits it.
- UpdateWorkspaceRequest: validate logo_url (nullable url) — FormRequest strips
  any unvalidated key, so without a rule it was silently dropped.
- WorkspaceController::updateSettings: pull logo_url out of the validated data
  (it is not a column) and attach it through LogoAttacher, mirroring store.
@cursor

cursor Bot commented Jul 3, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

…/catch

LogoAttacher::attach promised in its docblock that any failure — including a
persistence error — is logged and swallowed so the caller need not handle it.
But the persistence block was try/finally with no catch, so a Throwable from
clearMediaCollection/addMediaFromPath escaped. Both call sites (store and
updateSettings) each wrapped the call in an identical try/catch + Log::warning
to compensate — a band-aid duplicated across the controller.

Fix it at the root: the persistence block now catches Throwable, logs it, and
returns false, matching the documented contract. Both controller call sites
collapse to a single attach() line, and the now-unused Log/Throwable imports
are dropped.

Adds LogoAttacherTest covering the success path, the swallowed persistence
failure, a failed fetch, and a rejected mime type.
@cursor

cursor Bot commented Jul 3, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@paulocastellano paulocastellano merged commit f609073 into main Jul 3, 2026
2 checks passed
@paulocastellano paulocastellano deleted the fix/autofill-save-logo branch July 3, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant