From 4d43559fb49ed020a2d55f842f7007d800a9ff86 Mon Sep 17 00:00:00 2001 From: Yader Velasquez Date: Thu, 15 Feb 2024 15:34:36 -0600 Subject: [PATCH] Always display upgrade message. References: https://todo.code.netlandish.com/~netlandish/links/48 --- core/routes.go | 11 ++++------- templates/inactive_domain.html | 4 +--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/core/routes.go b/core/routes.go index f75115e..d2e5f5d 100644 --- a/core/routes.go +++ b/core/routes.go @@ -107,21 +107,18 @@ func (s *Service) InvalidDomain(c echo.Context) error { sq.Eq{"d.lookup_name": d}, sq.Eq{"d.is_active": false}, }, + Limit: 1, } domains, err := models.GetDomains(c.Request().Context(), opts) if err != nil { return err } - if len(domains) != 1 { - pd.Data["msg"] = lt.Translate("The %s domain is invalid", d) - return gctx.Render(http.StatusOK, "inactive_domain.html", gmap) + if len(domains) == 0 { + // NOTE Should not happens, but just in case + return echo.NotFoundHandler(c) } - domain := domains[0] pd.Data["msg"] = lt.Translate("The %s domain is currently inactive", d) pd.Data["please_upgrade"] = lt.Translate("Please upgrade your account to reactivate it") - if domain.OrgSlug.Valid { - gmap["orgSlug"] = domain.OrgSlug.String - } return gctx.Render(http.StatusOK, "inactive_domain.html", gmap) } diff --git a/templates/inactive_domain.html b/templates/inactive_domain.html index 249edf0..0b018b8 100644 --- a/templates/inactive_domain.html +++ b/templates/inactive_domain.html @@ -4,8 +4,6 @@

{{.pd.Data.msg}}

- {{ if .orgSlug }} -

{{.pd.Data.please_upgrade}}

- {{end}} +

{{.pd.Data.please_upgrade}}

{{template "base_footer" .}} -- 2.45.2