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: address PR review findings

Paulo Castellano7cc88f103681
diff --git a/app/Http/Controllers/Auth/LinkedInController.php b/app/Http/Controllers/Auth/LinkedInController.php
index a493d7257..05fb0b44b 100644
--- a/app/Http/Controllers/Auth/LinkedInController.php
+++ b/app/Http/Controllers/Auth/LinkedInController.php
@@ -6,6 +6,7 @@ namespace App\Http\Controllers\Auth;
use App\Enums\SocialAccount\Platform as SocialPlatform;
use App\Enums\SocialAccount\Status;
+use App\Exceptions\SocialAccount\NetworkAlreadyConnectedException;
use App\Models\Workspace;
use App\Services\Social\LinkedInTokenSynchronizer;
use Illuminate\Http\RedirectResponse;
@@ -83,6 +84,8 @@ class LinkedInController extends SocialController
app(LinkedInTokenSynchronizer::class)->syncTokens($account);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
+ } catch (NetworkAlreadyConnectedException $e) {
+ return $this->popupCallback(false, __('accounts.popup_callback.network_taken'), $this->platform->value);
} catch (\Exception $e) {
Log::error('LinkedIn OAuth Error', [
'error' => $e->getMessage(),
diff --git a/resources/js/components/accounts/NetworkConnectGrid.vue b/resources/js/components/accounts/NetworkConnectGrid.vue
index 608349154..2a5c48251 100644
--- a/resources/js/components/accounts/NetworkConnectGrid.vue
+++ b/resources/js/components/accounts/NetworkConnectGrid.vue
@@ -41,8 +41,6 @@ const props = withDefaults(
},
);
-const emit = defineEmits<{ connect: [] }>();
-
const getPlatformDescription = (platform: string): string =>
trans(`accounts.descriptions.${platform}`);
@@ -182,8 +180,6 @@ const needsReconnect = (account: ConnectedAccount): boolean =>
account.status === 'disconnected' || account.status === 'token_expired';
const openConnect = (platformValue: string) => {
- emit('connect');
-
if (platformValue === Platform.Telegram) {
telegramOpen.value = true;
return;
diff --git a/resources/js/pages/settings/account/Billing.vue b/resources/js/pages/settings/account/Billing.vue
index 81241fb19..871d92332 100644
--- a/resources/js/pages/settings/account/Billing.vue
+++ b/resources/js/pages/settings/account/Billing.vue
@@ -67,7 +67,7 @@ const displayPrice = (slug: string | undefined): string => {
return trans(`billing.subscribe.prices.${slug}.${key}`);
};
-const workspacesLabel = computed(() => transChoice('billing.plan.workspaces', props.workspaceCount, { count: props.workspaceCount }));
+const workspacesLabel = computed(() => transChoice('billing.plan.workspaces', props.workspaceCount, { count: String(props.workspaceCount) }));
const monthlyPrice = computed(() => (props.plan ? trans(`billing.subscribe.prices.${props.plan.slug}.monthly`) : ''));
const yearlyPerMonthPrice = computed(() => (props.plan ? trans(`billing.subscribe.prices.${props.plan.slug}.yearly_per_month`) : ''));
diff --git a/tests/Feature/Billing/BillingCycleTest.php b/tests/Feature/Billing/BillingCycleTest.php
index 86b79d103..c4ed42327 100644
--- a/tests/Feature/Billing/BillingCycleTest.php
+++ b/tests/Feature/Billing/BillingCycleTest.php
@@ -32,6 +32,20 @@ test('during trial the allotment is the monthly amount even on a yearly price',
expect(BillingCycle::for($account)->creditAllotment())->toBe(2500);
});
+test('during trial the window spans the subscription creation to the trial end', function () {
+ Carbon::setTestNow('2026-06-20 12:00:00');
+
+ $account = billingAccount('price_year', [
+ 'created_at' => Carbon::parse('2026-06-18'),
+ 'trial_ends_at' => Carbon::parse('2026-06-25'),
+ ], workspaces: 1);
+
+ $cycle = BillingCycle::for($account);
+
+ expect($cycle->periodStart()->toDateString())->toBe('2026-06-18')
+ ->and($cycle->periodEnd()->toDateString())->toBe('2026-06-25');
+});
+
test('monthly cycle window spans the anchor day to the next month', function () {
Carbon::setTestNow('2026-06-20 12:00:00');
$account = billingAccount('price_month', ['created_at' => Carbon::parse('2026-03-05')]);
diff --git a/tests/Feature/Listeners/StripeEventListenerTest.php b/tests/Feature/Listeners/StripeEventListenerTest.php
index 74ffc0ffb..a3f71f5ca 100644
--- a/tests/Feature/Listeners/StripeEventListenerTest.php
+++ b/tests/Feature/Listeners/StripeEventListenerTest.php
@@ -433,7 +433,7 @@ test('subscription created forwards a null previous plan when account had none',
});
// ========================================
-// Pennant feature cache invalidation
+// Plan mapping by Stripe price id
// ========================================
test('subscription updated maps the plan by price id', function () {
diff --git a/tests/Feature/Social/LinkedInControllerTest.php b/tests/Feature/Social/LinkedInControllerTest.php
index baf35e68f..953f7ad1e 100644
--- a/tests/Feature/Social/LinkedInControllerTest.php
+++ b/tests/Feature/Social/LinkedInControllerTest.php
@@ -135,6 +135,50 @@ test('linkedin oauth callback creates account', function () {
]);
});
+test('linkedin callback shows network_taken when the linkedin network is already connected', function () {
+ config()->set('trypost.self_hosted', false);
+
+ // A LinkedIn Page occupies the shared "linkedin" network for this workspace.
+ SocialAccount::factory()->linkedinPage()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform_user_id' => 'existing-linkedin-page',
+ ]);
+
+ session(['social_connect_workspace' => $this->workspace->id]);
+
+ $socialiteUser = Mockery::mock(SocialiteUser::class);
+ $socialiteUser->shouldReceive('getId')->andReturn('new-profile-id');
+ $socialiteUser->shouldReceive('getName')->andReturn('John Doe');
+ $socialiteUser->shouldReceive('getAvatar')->andReturn(null);
+ $socialiteUser->token = 'test-access-token';
+ $socialiteUser->refreshToken = 'test-refresh-token';
+ $socialiteUser->expiresIn = 5184000;
+ $socialiteUser->approvedScopes = ['openid', 'profile', 'email', 'w_member_social'];
+
+ Socialite::shouldReceive('driver')
+ ->with('linkedin')
+ ->andReturn(Mockery::mock(['user' => $socialiteUser]));
+
+ Http::fake([
+ 'https://api.linkedin.com/v2/me*' => Http::response([
+ 'id' => 'new-profile-id',
+ 'vanityName' => 'johndoe',
+ ], 200),
+ ]);
+
+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin.callback'));
+
+ $response->assertOk();
+ $response->assertViewIs('auth.social-callback');
+ $response->assertViewHas('success', false);
+ $response->assertViewHas('message', __('accounts.popup_callback.network_taken'));
+
+ $this->assertDatabaseMissing('social_accounts', [
+ 'platform' => Platform::LinkedIn->value,
+ 'platform_user_id' => 'new-profile-id',
+ ]);
+});
+
test('linkedin oauth callback splits comma-separated approvedScopes before saving', function () {
session(['social_connect_workspace' => $this->workspace->id]);