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.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
fix: do not set plan_id on checkout creation; drop redundant guards
Paulo Castellanoaadfe7d6e80d
diff --git a/app/Http/Controllers/App/BillingController.php b/app/Http/Controllers/App/BillingController.phpindex 3338e4bba..67836c766 100644--- a/app/Http/Controllers/App/BillingController.php+++ b/app/Http/Controllers/App/BillingController.php@@ -70,12 +70,6 @@ class BillingController extends Controller'cancel_url' => route('app.subscribe'),]);- $account->update(['plan_id' => $plan->id]);-- if ($account->wasChanged('plan_id')) {- $account->forgetPlanFeatureCache();- }-return Inertia::location($checkoutSession->url);}@@ -167,10 +161,7 @@ class BillingController extends Controller$subscription->swap($priceId);$account->update(['plan_id' => $plan->id]);-- if ($account->wasChanged('plan_id')) {- $account->forgetPlanFeatureCache();- }+ $account->forgetPlanFeatureCache();return redirect()->route('app.billing.index')->with('flash.success', __('billing.flash.plan_changed', ['plan' => $plan->name]));diff --git a/app/Listeners/StripeEventListener.php b/app/Listeners/StripeEventListener.phpindex 02f361f81..e2634b902 100644--- a/app/Listeners/StripeEventListener.php+++ b/app/Listeners/StripeEventListener.php@@ -53,10 +53,7 @@ class StripeEventListenerif ($plan = $this->resolvePlanFromSubscriptionItems($payload, $account)) {$account->update(['plan_id' => $plan->id]);-- if ($account->wasChanged('plan_id')) {- $account->forgetPlanFeatureCache();- }+ $account->forgetPlanFeatureCache();}SubscriptionCreated::dispatch($account);@@ -78,10 +75,7 @@ class StripeEventListenerif ($plan = $this->resolvePlanFromSubscriptionItems($payload, $account)) {$account->update(['plan_id' => $plan->id]);-- if ($account->wasChanged('plan_id')) {- $account->forgetPlanFeatureCache();- }+ $account->forgetPlanFeatureCache();}$this->trackPlanChange($account, BillingEvent::Updated, $previousPlan, $payload);@@ -100,10 +94,7 @@ class StripeEventListener$previousPlan = $account->plan?->name;$account->update(['plan_id' => null]);-- if ($account->wasChanged('plan_id')) {- $account->forgetPlanFeatureCache();- }+ $account->forgetPlanFeatureCache();$this->trackPlanChange($account, BillingEvent::Cancelled, $previousPlan, $payload);}diff --git a/tests/Feature/Listeners/StripeEventListenerTest.php b/tests/Feature/Listeners/StripeEventListenerTest.phpindex fba305d0e..92b4c7cb0 100644--- a/tests/Feature/Listeners/StripeEventListenerTest.php+++ b/tests/Feature/Listeners/StripeEventListenerTest.php@@ -447,30 +447,3 @@ test('subscription deleted flushes the pennant cache', function () {expect(DB::table('features')->where('scope', 'account|'.$this->account->id)->count())->toBe(0);});--test('subscription updated with same plan does not flush the pennant cache', function () {- $starter = Plan::query()->where('slug', 'starter')->firstOrFail();- $this->account->update(['plan_id' => $starter->id]);-- Feature::for($this->account)->value(WorkspaceLimit::class);-- $cachedRow = DB::table('features')- ->where('scope', 'account|'.$this->account->id)- ->first();-- expect($cachedRow)->not->toBeNull();-- $this->listener->handle(new WebhookReceived([- 'type' => 'customer.subscription.updated',- 'data' => ['object' => [- 'customer' => 'cus_test123',- 'items' => ['data' => [['price' => ['id' => 'price_starter_monthly']]]],- ]],- ]));-- $stillCachedRow = DB::table('features')- ->where('scope', 'account|'.$this->account->id)- ->first();-- expect($stillCachedRow->id)->toBe($cachedRow->id);-});