Skip to content

Commit c30a3dc

Browse files
authored
Fix orga plan expiration warning (#8730)
This PR fixes a regression of PR #8672 that would always show a warning that your orga plan is using too much storage. For some reason, in a previous WK build most of this code was commented out and got commented in with PR #8672 causing the regression. <img width="1295" alt="Screenshot 2025-06-30 at 16 37 44" src="https://github.com/user-attachments/assets/d6516a5b-5798-4893-8871-aa9d86aea67e" /> ### Issues: - fixes https://scm.slack.com/archives/C5AKLAV0B/p1751293404276169 ------ (Please delete unneeded items, merge only when none are left open) - [ ] Added changelog entry (create a `$PR_NUMBER.md` file in `unreleased_changes` or use `./tools/create-changelog-entry.py`) - [ ] Added migration guide entry if applicable (edit the same file as for the changelog) - [ ] Updated [documentation](../blob/master/docs) if applicable - [ ] Adapted [wk-libs python client](https://github.com/scalableminds/webknossos-libs/tree/master/webknossos/webknossos/client) if relevant API parts change - [ ] Removed dev-only changes like prints and application.conf edits - [ ] Considered [common edge cases](../blob/master/.github/common_edge_cases.md) - [ ] Needs datastore update after deployment
1 parent b2ccbaa commit c30a3dc

File tree

1 file changed

+20
-46
lines changed

1 file changed

+20
-46
lines changed

frontend/javascripts/admin/organization/organization_cards.tsx

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -161,56 +161,30 @@ export function PlanExceededAlert({ organization }: { organization: APIOrganizat
161161
}
162162

163163
export function PlanAboutToExceedAlert({ organization }: { organization: APIOrganization }) {
164-
const alerts = [];
165164
const activeUser = useWkSelector((state) => state.activeUser);
166165
const isAboutToExpire =
167166
dayjs.duration(dayjs(organization.paidUntil).diff(dayjs())).asWeeks() <= 6 &&
168167
!hasPricingPlanExpired(organization);
169168

170-
if (isAboutToExpire)
171-
alerts.push({
172-
message:
173-
"Your WEBKNOSSOS plan is about to expire soon. Renew your plan now to avoid being downgraded, users being blocked, and losing access to features.",
174-
actionButton: (
175-
<Button
176-
size="small"
177-
type="primary"
178-
onClick={() => UpgradePricingPlanModal.extendPricingPlan(organization)}
179-
>
180-
Extend Plan Now
181-
</Button>
182-
),
183-
});
184-
else {
185-
alerts.push({
186-
message:
187-
"Your organization is about to exceed the storage space included in your current plan. Upgrade now to avoid your account from being blocked.",
188-
actionButton: (
189-
<Button
190-
size="small"
191-
type="primary"
192-
onClick={() => UpgradePricingPlanModal.upgradePricingPlan(organization)}
193-
>
194-
Upgrade Now
195-
</Button>
196-
),
197-
});
198-
}
169+
if (isAboutToExpire) {
170+
const actionButton = (
171+
<Button
172+
size="small"
173+
type="primary"
174+
onClick={() => UpgradePricingPlanModal.extendPricingPlan(organization)}
175+
>
176+
Extend Plan Now
177+
</Button>
178+
);
199179

200-
return (
201-
<>
202-
{alerts.map((alert) => (
203-
<Alert
204-
key={alert.message.slice(0, 10)}
205-
showIcon
206-
type="warning"
207-
message={alert.message}
208-
action={
209-
activeUser && isUserAllowedToRequestUpgrades(activeUser) ? alert.actionButton : null
210-
}
211-
style={{ marginBottom: 20 }}
212-
/>
213-
))}
214-
</>
215-
);
180+
return (
181+
<Alert
182+
showIcon
183+
type="warning"
184+
message="Your WEBKNOSSOS plan is about to expire soon. Renew your plan now to avoid being downgraded, users being blocked, and losing access to features."
185+
action={activeUser && isUserAllowedToRequestUpgrades(activeUser) ? actionButton : null}
186+
style={{ marginBottom: 20 }}
187+
/>
188+
);
189+
} else return null;
216190
}

0 commit comments

Comments
 (0)