[MM-40407] - Do not show the Renew Now if the license id does not exist in the portal (#19188)

* [MM-40407] - Do not show the Renew Now if the license id does not exist in the portal

* improvements

* impl mock

* fix translations

* feedback impl

* fix typo

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Allan Guwatudde
2021-12-21 09:46:02 +03:00
коммит произвёл GitHub
родитель 34c4e543f9
Коммит 81409ee7c4
6 изменённых файлов: 34 добавлений и 6 удалений

Просмотреть файл

@@ -266,12 +266,19 @@ func requestRenewalLink(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
renewalLink, err := c.App.Srv().GenerateLicenseRenewalLink()
renewalLink, token, err := c.App.Srv().GenerateLicenseRenewalLink()
if err != nil {
c.Err = err
return
}
// check if it is possible to renew license on the portal with generated token
e := c.App.Cloud().GetLicenseRenewalStatus(c.AppContext.Session().UserId, token)
if e != nil {
c.Err = model.NewAppError("requestRenewalLink", "api.license.request_renewal_link.cannot_renew_on_cws", nil, e.Error(), http.StatusBadRequest)
return
}
auditRec.Success()
c.LogAudit("success")