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.

Fix workspace name-only update rejected by required brand fields

Paulo Castellano2f047f2f7e93
diff --git a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php
index 3abeec7f9..405149429 100644
--- a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php
+++ b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php
@@ -29,8 +29,8 @@ class UpdateWorkspaceRequest extends FormRequest
'brand_color' => $hex,
'background_color' => $hex,
'text_color' => $hex,
- 'brand_font' => ['required', 'string', Rule::in(BrandFont::values())],
- 'image_style' => ['required', 'string', Rule::in(ImageStyle::values())],
+ 'brand_font' => ['sometimes', 'required', 'string', Rule::in(BrandFont::values())],
+ 'image_style' => ['sometimes', 'required', 'string', Rule::in(ImageStyle::values())],
'content_language' => ['sometimes', 'string', 'in:en,pt-BR,es'],
];
}
diff --git a/tests/Feature/WorkspaceControllerTest.php b/tests/Feature/WorkspaceControllerTest.php
index 1922f0c57..aa0ed4f24 100644
--- a/tests/Feature/WorkspaceControllerTest.php
+++ b/tests/Feature/WorkspaceControllerTest.php
@@ -232,6 +232,27 @@ test('update workspace settings persists the image_style choice', function () {
expect($this->workspace->refresh()->image_style->value)->toBe('minimalist');
});
+test('update workspace settings updates the name when only the name is submitted', function () {
+ $this->actingAs($this->user)
+ ->from(route('app.workspace.settings'))
+ ->put(route('app.workspace.settings.update'), [
+ 'name' => 'Name Only Update',
+ ])
+ ->assertRedirect(route('app.workspace.settings'))
+ ->assertSessionHasNoErrors();
+
+ expect($this->workspace->refresh()->name)->toBe('Name Only Update');
+});
+
+test('update workspace settings still requires brand_font and image_style when submitted empty', function () {
+ $this->actingAs($this->user)
+ ->put(route('app.workspace.settings.update'), [
+ 'name' => $this->workspace->name,
+ 'brand_font' => '',
+ 'image_style' => '',
+ ])->assertSessionHasErrors(['brand_font', 'image_style']);
+});
+
test('update workspace settings rejects unknown image_style values', function () {
$this->actingAs($this->user)
->put(route('app.workspace.settings.update'), [