[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 удалений

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

@@ -369,11 +369,11 @@ func (s *Server) renewalTokenValid(tokenString, signingKey string) (bool, error)
}
// GenerateLicenseRenewalLink returns a link that points to the CWS where clients can renew license
func (s *Server) GenerateLicenseRenewalLink() (string, *model.AppError) {
func (s *Server) GenerateLicenseRenewalLink() (string, string, *model.AppError) {
renewalToken, err := s.GenerateRenewalToken(JWTDefaultTokenExpiration)
if err != nil {
return "", err
return "", "", err
}
renewalLink := LicenseRenewalURL + "?token=" + renewalToken
return renewalLink, nil
return renewalLink, renewalToken, nil
}

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

@@ -1644,7 +1644,7 @@ func (s *Server) sendLicenseUpForRenewalEmail(users map[string]*model.User, lice
daysToExpiration := license.DaysToExpiration()
renewalLink, appErr := s.GenerateLicenseRenewalLink()
renewalLink, _, appErr := s.GenerateLicenseRenewalLink()
if appErr != nil {
return model.NewAppError("s.sendLicenseUpForRenewalEmail", "api.server.license_up_for_renewal.error_generating_link", nil, appErr.Error(), http.StatusInternalServerError)
}
@@ -1735,7 +1735,7 @@ func (s *Server) doLicenseExpirationCheck() {
// SendRemoveExpiredLicenseEmail formats an email and uses the email service to send the email to user with link pointing to CWS
// to renew the user license
func (s *Server) SendRemoveExpiredLicenseEmail(email string, locale, siteURL string) *model.AppError {
renewalLink, err := s.GenerateLicenseRenewalLink()
renewalLink, _, err := s.GenerateLicenseRenewalLink()
if err != nil {
return err
}