chore: temporarily disable exam-prep subscription enforcement
Add ExamPrepSubscriptionGateDisabled so learners can access exam-prep content without an IELTS or Duolingo plan. LMS subscription gating is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
c9a4bc1306
commit
4f873fe9de
|
|
@ -23,6 +23,9 @@ type SubscriptionExpiryReminder struct {
|
||||||
// CategorySubscriptionGateDisabled skips subscription enforcement on learner-facing routes (temporary).
|
// CategorySubscriptionGateDisabled skips subscription enforcement on learner-facing routes (temporary).
|
||||||
var CategorySubscriptionGateDisabled = false
|
var CategorySubscriptionGateDisabled = false
|
||||||
|
|
||||||
|
// ExamPrepSubscriptionGateDisabled skips IELTS/DUOLINGO subscription checks on exam-prep routes (temporary).
|
||||||
|
var ExamPrepSubscriptionGateDisabled = true
|
||||||
|
|
||||||
// IsLMSSubscriptionCategory reports plan categories that unlock Learn English (LMS) content.
|
// IsLMSSubscriptionCategory reports plan categories that unlock Learn English (LMS) content.
|
||||||
func IsLMSSubscriptionCategory(category string) bool {
|
func IsLMSSubscriptionCategory(category string) bool {
|
||||||
return normalizeSubscriptionCategory(category) == string(SubscriptionCategoryLearnEnglish)
|
return normalizeSubscriptionCategory(category) == string(SubscriptionCategoryLearnEnglish)
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,14 @@ func filterCoursesForLearner(items []domain.Course, program domain.Program, hasL
|
||||||
}
|
}
|
||||||
|
|
||||||
func filterExamPrepCatalogCoursesForLearner(items []domain.ExamPrepCatalogCourse, hasIELTS, hasDuolingo bool) []domain.ExamPrepCatalogCourse {
|
func filterExamPrepCatalogCoursesForLearner(items []domain.ExamPrepCatalogCourse, hasIELTS, hasDuolingo bool) []domain.ExamPrepCatalogCourse {
|
||||||
|
if domain.ExamPrepSubscriptionGateDisabled {
|
||||||
|
out := make([]domain.ExamPrepCatalogCourse, 0, len(items))
|
||||||
|
for _, item := range items {
|
||||||
|
applyExamPrepCatalogCourseEffectiveAccessTier(&item)
|
||||||
|
out = append(out, item)
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
filtered := make([]domain.ExamPrepCatalogCourse, 0, len(items))
|
filtered := make([]domain.ExamPrepCatalogCourse, 0, len(items))
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
applyExamPrepCatalogCourseEffectiveAccessTier(&item)
|
applyExamPrepCatalogCourseEffectiveAccessTier(&item)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func (h *Handler) learnerHasSubscriptionCategory(c *fiber.Ctx, category domain.S
|
||||||
|
|
||||||
func (h *Handler) ensureLearnerExamPrepContentAccess(c *fiber.Ctx, contentCategory string, effectiveTier domain.ContentAccessTier) error {
|
func (h *Handler) ensureLearnerExamPrepContentAccess(c *fiber.Ctx, contentCategory string, effectiveTier domain.ContentAccessTier) error {
|
||||||
role, _ := c.Locals("role").(domain.Role)
|
role, _ := c.Locals("role").(domain.Role)
|
||||||
if !role.IsCustomerLearnerRole() {
|
if !role.IsCustomerLearnerRole() || domain.ExamPrepSubscriptionGateDisabled {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !domain.IsExamPrepContentCategory(contentCategory) {
|
if !domain.IsExamPrepContentCategory(contentCategory) {
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ func (a *App) RequireExamPrepSubscription() fiber.Handler {
|
||||||
if role != domain.RoleStudent && role != domain.RoleOpenLearner {
|
if role != domain.RoleStudent && role != domain.RoleOpenLearner {
|
||||||
return c.Next()
|
return c.Next()
|
||||||
}
|
}
|
||||||
if domain.CategorySubscriptionGateDisabled {
|
if domain.CategorySubscriptionGateDisabled || domain.ExamPrepSubscriptionGateDisabled {
|
||||||
return c.Next()
|
return c.Next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user