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(linkedin): show connected company page on the accounts and onboarding grids

Paulo Castellanodec2bc028a57
diff --git a/app/Http/Controllers/App/OnboardingController.php b/app/Http/Controllers/App/OnboardingController.php
index 06410983e..1c488797b 100644
--- a/app/Http/Controllers/App/OnboardingController.php
+++ b/app/Http/Controllers/App/OnboardingController.php
@@ -86,12 +86,14 @@ class OnboardingController extends Controller
$accounts = $workspace->socialAccounts()->orderBy('id')->get();
- $platforms = collect(SocialPlatform::enabled())->map(fn (SocialPlatform $platform): array => [
- 'value' => $platform->value,
- 'label' => $platform->label(),
- 'color' => $platform->color(),
- 'network' => $platform->network(),
- ])->values();
+ $platforms = collect(SocialPlatform::cases())
+ ->filter(fn (SocialPlatform $platform): bool => $platform->isConnectable())
+ ->map(fn (SocialPlatform $platform): array => [
+ 'value' => $platform->value,
+ 'label' => $platform->label(),
+ 'color' => $platform->color(),
+ 'network' => $platform->network(),
+ ])->values();
return Inertia::render('onboarding/Connect', [
'platforms' => $platforms,
diff --git a/app/Http/Resources/App/SocialAccountResource.php b/app/Http/Resources/App/SocialAccountResource.php
index bee0dda4e..e4bef4e52 100644
--- a/app/Http/Resources/App/SocialAccountResource.php
+++ b/app/Http/Resources/App/SocialAccountResource.php
@@ -17,6 +17,7 @@ class SocialAccountResource extends JsonResource
return [
'id' => $this->id,
'platform' => $this->platform,
+ 'network' => $this->platform->network(),
'platform_user_id' => $this->platform_user_id,
'username' => $this->username,
'display_name' => $this->display_name,
diff --git a/resources/js/components/accounts/NetworkConnectGrid.vue b/resources/js/components/accounts/NetworkConnectGrid.vue
index 4808ae548..7e916b043 100644
--- a/resources/js/components/accounts/NetworkConnectGrid.vue
+++ b/resources/js/components/accounts/NetworkConnectGrid.vue
@@ -21,6 +21,7 @@ export interface AvailablePlatform {
export interface ConnectedAccount {
id: string;
platform: string;
+ network: string;
username: string;
display_name: string;
avatar_url: string | null;
@@ -120,20 +121,14 @@ const platformTheme: Record<
const themeFor = (value: string) =>
platformTheme[value] ?? { bg: 'bg-muted', rotate: '', image: '' };
-const networkOf = (value: string): string =>
- props.platforms.find((platform) => platform.value === value)?.network ??
- value;
-
// One account per network: map each connected network to its account so every
// platform card belonging to that network reflects the connection.
const connectedByNetwork = computed((): Record<string, ConnectedAccount> => {
const map: Record<string, ConnectedAccount> = {};
for (const account of props.connectedAccounts) {
- const network = networkOf(account.platform);
-
- if (!map[network]) {
- map[network] = account;
+ if (!map[account.network]) {
+ map[account.network] = account;
}
}
diff --git a/tests/Feature/Onboarding/OnboardingControllerTest.php b/tests/Feature/Onboarding/OnboardingControllerTest.php
index ba489b974..aac0c9bd9 100644
--- a/tests/Feature/Onboarding/OnboardingControllerTest.php
+++ b/tests/Feature/Onboarding/OnboardingControllerTest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
use App\Actions\Billing\StartSubscriptionCheckout;
use App\Enums\Plan\Slug;
+use App\Enums\SocialAccount\Platform;
use App\Enums\User\Persona;
use App\Jobs\PostHog\SendEvent;
use App\Models\Account;
@@ -135,6 +136,21 @@ test('connect renders the network grid for an unsubscribed account that picked a
);
});
+test('connect offers a single linkedin card and no standalone linkedin page card', function () {
+ $this->user->update(['persona' => Persona::Agency->value]);
+ onboardingWorkspace($this->user);
+
+ $response = $this->actingAs($this->user->fresh())->get(route('app.onboarding.connect'));
+
+ $response->assertOk();
+ $response->assertInertia(fn ($page) => $page
+ ->component('onboarding/Connect')
+ ->where('platforms', fn ($platforms) => collect($platforms)->contains('value', Platform::LinkedIn->value)
+ && ! collect($platforms)->contains('value', Platform::LinkedInPage->value)
+ )
+ );
+});
+
test('connect lists the workspace social accounts already connected', function () {
$this->user->update(['persona' => Persona::Agency->value]);
$workspace = onboardingWorkspace($this->user);
diff --git a/tests/Feature/SocialControllerTest.php b/tests/Feature/SocialControllerTest.php
index 9a99e62a4..12b960f0f 100644
--- a/tests/Feature/SocialControllerTest.php
+++ b/tests/Feature/SocialControllerTest.php
@@ -87,9 +87,12 @@ test('a connected linkedin page account is still returned so it surfaces under t
$response = $this->actingAs($this->user)->get(route('app.accounts'));
$response->assertOk();
+ // The grid groups by the account's own `network`, so a linkedin-page account
+ // must report network=linkedin to surface under the single LinkedIn card.
$response->assertInertia(fn ($page) => $page
->component('accounts/Index', false)
->where('connectedAccounts.0.platform', Platform::LinkedInPage->value)
+ ->where('connectedAccounts.0.network', 'linkedin')
);
});