Skip to content

Commit 913735b

Browse files
committed
RG-T125 PR#423 fixes
1 parent 3b54d2e commit 913735b

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Core/Resgrid.Services/DepartmentsService.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,13 @@ public async Task<Department> GetActiveSmsDepartmentForUserAsync(string userId,
459459
// of the user's departments that does, so a user whose active department is on the free plan still
460460
// lands in an SMS-capable department. If none support SMS, fall back to the preferred one so the
461461
// caller's plan gate returns the proper "plan doesn't support" message.
462-
foreach (var membership in ordered)
462+
var canProvisionNumber = await Task.WhenAll(ordered.Select(membership =>
463+
_limitsService.CanDepartmentProvisionNumberAsync(membership.DepartmentId)));
464+
465+
for (var i = 0; i < ordered.Count; i++)
463466
{
464-
if (await _limitsService.CanDepartmentProvisionNumberAsync(membership.DepartmentId))
465-
return await GetDepartmentByIdAsync(membership.DepartmentId, bypassCache);
467+
if (canProvisionNumber[i])
468+
return await GetDepartmentByIdAsync(ordered[i].DepartmentId, bypassCache);
466469
}
467470

468471
return await GetDepartmentByIdAsync(preferred.DepartmentId, bypassCache);

Core/Resgrid.Services/SubscriptionsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public bool IsPlanRestrictedOrFree(int planId)
608608
// move to Entity-based plans, SMS was removed from the free tiers, so "supports SMS/paid features"
609609
// is simply "not one of these". Mirrors the authoritative set in the CommonApis billing service.
610610
// 1 = Free, 6 = Beta (2yr), 7 = Open Preview, 8 = Unlimited Free.
611-
return planId == FreePlanId || planId == 6 || planId == 7 || planId == 8;
611+
return planId == FreePlanId || planId == (int)Plans.Beta2YrPlanId || planId == (int)Plans.OpenPreviewPlanId || planId == (int)Plans.UnlimitedFreePlanId;
612612
}
613613

614614
/// <summary>

0 commit comments

Comments
 (0)