File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,8 @@ function Component() {
155155 </ Alert >
156156 ) }
157157 { organization . subscriptionPeriodEventsCountExceededAt &&
158- organization . isActive && (
158+ organization . isActive &&
159+ organization . isExceeded && (
159160 < Alert
160161 title = "Events limit exceeded"
161162 description = { `Your subscription has exceeded the limit on ${ format ( organization . subscriptionPeriodEventsCountExceededAt , 'PPP' ) } ` }
Original file line number Diff line number Diff line change @@ -57,16 +57,22 @@ const updateEventsCount = cacheable(async function updateEventsCount(
5757 }
5858
5959 if ( organizationEventsCount ) {
60+ // Self-hosting has no billing/event limits. Never flag the org as
61+ // exceeded, and clear any stale flag that was set before this guard
62+ // existed (default limit is 0, which otherwise trips on the first event).
63+ const isSelfHosted = process . env . SELF_HOSTED === 'true' ;
64+
6065 await db . organization . update ( {
6166 where : {
6267 id : organization . id ,
6368 } ,
6469 data : {
6570 subscriptionPeriodEventsCount : organizationEventsCount ,
66- subscriptionPeriodEventsCountExceededAt :
67- organizationEventsCount >
68- organization . subscriptionPeriodEventsLimit &&
69- ! organization . subscriptionPeriodEventsCountExceededAt
71+ subscriptionPeriodEventsCountExceededAt : isSelfHosted
72+ ? null
73+ : organizationEventsCount >
74+ organization . subscriptionPeriodEventsLimit &&
75+ ! organization . subscriptionPeriodEventsCountExceededAt
7076 ? new Date ( )
7177 : organizationEventsCount <=
7278 organization . subscriptionPeriodEventsLimit
You can’t perform that action at this time.
0 commit comments