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): default content_language to the app locale, not 'en'

Paulo Sérgio Dantas7dab106f063b
diff --git a/app/Actions/Workspace/CreateWorkspace.php b/app/Actions/Workspace/CreateWorkspace.php
index 4c42fe67b..3c7c2df0e 100644
--- a/app/Actions/Workspace/CreateWorkspace.php
+++ b/app/Actions/Workspace/CreateWorkspace.php
@@ -24,7 +24,7 @@ class CreateWorkspace
'brand_color' => data_get($data, 'brand_color'),
'background_color' => data_get($data, 'background_color'),
'text_color' => data_get($data, 'text_color'),
- 'content_language' => data_get($data, 'content_language'),
+ 'content_language' => data_get($data, 'content_language', app()->getLocale()),
], static fn ($value): bool => $value !== null);
$workspace = DB::transaction(function () use ($user, $attributes): Workspace {
diff --git a/tests/Feature/Actions/Workspace/CreateWorkspaceTest.php b/tests/Feature/Actions/Workspace/CreateWorkspaceTest.php
index a31bf419d..7c57efd32 100644
--- a/tests/Feature/Actions/Workspace/CreateWorkspaceTest.php
+++ b/tests/Feature/Actions/Workspace/CreateWorkspaceTest.php
@@ -42,6 +42,28 @@ test('CreateWorkspace switches user current workspace and attaches as admin', fu
expect($member?->pivot->role)->toBe(Role::Admin->value);
});
+test('CreateWorkspace inherits the app locale as content_language when none is given', function () {
+ app()->setLocale('pt-BR');
+
+ $account = Account::factory()->create();
+ $user = User::factory()->create(['account_id' => $account->id]);
+
+ $workspace = CreateWorkspace::execute($user, ['name' => 'Acme']);
+
+ expect($workspace->content_language)->toBe('pt-BR');
+});
+
+test('CreateWorkspace keeps an explicit content_language over the app locale', function () {
+ app()->setLocale('pt-BR');
+
+ $account = Account::factory()->create();
+ $user = User::factory()->create(['account_id' => $account->id]);
+
+ $workspace = CreateWorkspace::execute($user, ['name' => 'Acme', 'content_language' => 'es']);
+
+ expect($workspace->content_language)->toBe('es');
+});
+
test('CreateWorkspace ignores unknown extra keys like logo_url', function () {
$account = Account::factory()->create();
$user = User::factory()->create(['account_id' => $account->id]);