Fix free limits and email notifications for inactive users (#283)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
KM Koushik
2025-10-26 07:52:44 +11:00
committed by GitHub
parent 8e569f886e
commit 4fe354b85a
2 changed files with 7 additions and 4 deletions
+3 -2
View File
@@ -136,10 +136,11 @@ export class LimitService {
); );
const dailyUsage = usage.day.reduce((acc, curr) => acc + curr.sent, 0); const dailyUsage = usage.day.reduce((acc, curr) => acc + curr.sent, 0);
const activePlan = getActivePlan(team);
const dailyLimit = const dailyLimit =
team.plan !== "FREE" activePlan !== "FREE"
? team.dailyEmailLimit ? team.dailyEmailLimit
: PLAN_LIMITS[team.plan].emailsPerDay; : PLAN_LIMITS.FREE.emailsPerDay;
logger.info( logger.info(
{ dailyUsage, dailyLimit, team }, { dailyUsage, dailyLimit, team },
+4 -2
View File
@@ -400,7 +400,8 @@ export class TeamService {
} }
const team = await TeamService.getTeamCached(teamId); const team = await TeamService.getTeamCached(teamId);
const isPaidPlan = team.plan !== "FREE"; // Only consider it a paid plan if the subscription is active
const isPaidPlan = team.isActive && team.plan !== "FREE";
const html = await getLimitReachedEmail(teamId, limit, reason); const html = await getLimitReachedEmail(teamId, limit, reason);
@@ -501,7 +502,8 @@ export class TeamService {
} }
const team = await TeamService.getTeamCached(teamId); const team = await TeamService.getTeamCached(teamId);
const isPaidPlan = team.plan !== "FREE"; // Only consider it a paid plan if the subscription is active
const isPaidPlan = team.isActive && team.plan !== "FREE";
const period = const period =
reason === LimitReason.EMAIL_FREE_PLAN_MONTHLY_LIMIT_REACHED reason === LimitReason.EMAIL_FREE_PLAN_MONTHLY_LIMIT_REACHED