Fix free limits and email notifications for inactive users (#283)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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 },
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user