Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/web/src/server/service/limit-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ export class LimitService {
);

const dailyUsage = usage.day.reduce((acc, curr) => acc + curr.sent, 0);
const activePlan = getActivePlan(team);
const dailyLimit =
team.plan !== "FREE"
activePlan !== "FREE"
? team.dailyEmailLimit
: PLAN_LIMITS[team.plan].emailsPerDay;
: PLAN_LIMITS.FREE.emailsPerDay;

logger.info(
{ dailyUsage, dailyLimit, team },
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/server/service/team-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ export class TeamService {
}

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);

Expand Down Expand Up @@ -501,7 +502,8 @@ export class TeamService {
}

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 =
reason === LimitReason.EMAIL_FREE_PLAN_MONTHLY_LIMIT_REACHED
Expand Down