~netlandish/links

4d43559fb49ed020a2d55f842f7007d800a9ff86 — Yader Velasquez 9 months ago 801c4fd
Always display upgrade message.

References: https://todo.code.netlandish.com/~netlandish/links/48
2 files changed, 5 insertions(+), 10 deletions(-)

M core/routes.go
M templates/inactive_domain.html
M core/routes.go => core/routes.go +4 -7
@@ 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)
}


M templates/inactive_domain.html => templates/inactive_domain.html +1 -3
@@ 4,8 4,6 @@
</section>
<section class="card shadow-card">
  <p class="text-center">{{.pd.Data.msg}}</p>
  {{ if .orgSlug }}
      <p class="text-center"><a href={{reverse "billing:create_subscription" .orgSlug}}>{{.pd.Data.please_upgrade}}</a></p>
  {{end}}
  <p class="text-center"><a href={{reverse "core:org_list"}}>{{.pd.Data.please_upgrade}}</a></p>
</section>
{{template "base_footer" .}}