Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

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

Paulo Castellanob7773849ecd5
diff --git a/app/Http/Controllers/App/WorkspaceController.php b/app/Http/Controllers/App/WorkspaceController.php
index e26a22f71..a8451a024 100644
--- a/app/Http/Controllers/App/WorkspaceController.php
+++ b/app/Http/Controllers/App/WorkspaceController.php
@@ -198,7 +198,7 @@ class WorkspaceController extends Controller
return back()->with('flash.success', __('settings.flash.logo_deleted'));
}
- public function updateSettings(UpdateWorkspaceRequest $request): RedirectResponse
+ public function updateSettings(UpdateWorkspaceRequest $request, LogoAttacher $logoAttacher): RedirectResponse
{
$user = $request->user();
$workspace = $user->currentWorkspace;
@@ -209,7 +209,24 @@ class WorkspaceController extends Controller
$this->authorize('update', $workspace);
- $workspace->update($request->validated());
+ $validated = $request->validated();
+
+ $logoUrl = data_get($validated, 'logo_url');
+ unset($validated['logo_url']);
+
+ $workspace->update($validated);
+
+ if ($logoUrl) {
+ try {
+ $logoAttacher->attach($workspace, $logoUrl);
+ } catch (Throwable $e) {
+ Log::warning('Logo attach failed during workspace update', [
+ 'workspace_id' => $workspace->id,
+ 'logo_url' => $logoUrl,
+ 'error' => $e->getMessage(),
+ ]);
+ }
+ }
return back()->with('flash.success', __('settings.flash.workspace_updated'));
}
diff --git a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php
index 4a8f0dbac..6bb20ef0a 100644
--- a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php
+++ b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php
@@ -34,6 +34,7 @@ class UpdateWorkspaceRequest extends FormRequest
'brand_font' => ['sometimes', 'required', 'string', Rule::in(BrandFont::values())],
'image_style' => ['sometimes', 'required', 'string', Rule::in(ImageStyle::values())],
'content_language' => ['sometimes', 'string', Rule::in(ContentLanguage::values())],
+ 'logo_url' => ['nullable', 'url', 'max:1024'],
];
}
diff --git a/resources/js/components/settings/BrandTab.vue b/resources/js/components/settings/BrandTab.vue
index dceecbb6f..31b707383 100644
--- a/resources/js/components/settings/BrandTab.vue
+++ b/resources/js/components/settings/BrandTab.vue
@@ -40,6 +40,7 @@ const form = useForm({
brand_font: props.workspace.brand_font ?? 'Inter',
image_style: props.workspace.image_style ?? 'cinematic',
content_language: props.workspace.content_language ?? 'en',
+ logo_url: '' as string | null,
});
const submit = () => {
diff --git a/tests/Feature/WorkspaceControllerTest.php b/tests/Feature/WorkspaceControllerTest.php
index 5f1970a14..796bef210 100644
--- a/tests/Feature/WorkspaceControllerTest.php
+++ b/tests/Feature/WorkspaceControllerTest.php
@@ -697,3 +697,26 @@ test('store attaches logo when logo_url is provided', function () {
'logo_url' => 'https://example.com/logo.png',
])->assertRedirect();
});
+
+test('update settings attaches the autofilled logo when logo_url is provided', function () {
+ $logoAttacher = $this->mock(LogoAttacher::class);
+ $logoAttacher->shouldReceive('attach')->once();
+
+ $this->actingAs($this->user)
+ ->from(route('app.workspace.brand'))
+ ->put(route('app.workspace.settings.update'), [
+ 'name' => $this->workspace->name,
+ 'logo_url' => 'https://example.com/logo.png',
+ ])->assertRedirect(route('app.workspace.brand'))
+ ->assertSessionHasNoErrors();
+});
+
+test('update settings does not touch the logo when no logo_url is provided', function () {
+ $logoAttacher = $this->mock(LogoAttacher::class);
+ $logoAttacher->shouldReceive('attach')->never();
+
+ $this->actingAs($this->user)
+ ->put(route('app.workspace.settings.update'), [
+ 'name' => $this->workspace->name,
+ ])->assertRedirect();
+});