Mm 49496 Add state and jobs for preventing screened purchase attempts from retrying (#22188)

* make signup unavailable when screening is in progress
Этот коммит содержится в:
Nathaniel Allred
2023-02-02 15:48:59 -06:00
коммит произвёл GitHub
родитель a68515b69a
Коммит f713862041
7 изменённых файлов: 90 добавлений и 0 удалений

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

@@ -191,6 +191,13 @@ func (ps *PlatformService) SaveLicense(licenseBytes []byte) (*model.License, *mo
ps.RemoveLicense()
return nil, model.NewAppError("addLicense", "api.license.add_license.save_active.app_error", nil, "", http.StatusInternalServerError)
}
// only on prem licenses set this in the first place
if !license.IsCloud() {
_, err := ps.Store.System().PermanentDeleteByName(model.SystemHostedPurchaseNeedsScreening)
if err != nil {
ps.logger.Warn(fmt.Sprintf("Failed to remove %s system store key", model.SystemHostedPurchaseNeedsScreening))
}
}
ps.ReloadConfig()
ps.InvalidateAllCaches()

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

@@ -41,6 +41,7 @@ import (
"github.com/mattermost/mattermost-server/v6/jobs/export_delete"
"github.com/mattermost/mattermost-server/v6/jobs/export_process"
"github.com/mattermost/mattermost-server/v6/jobs/extract_content"
"github.com/mattermost/mattermost-server/v6/jobs/hosted_purchase_screening"
"github.com/mattermost/mattermost-server/v6/jobs/import_delete"
"github.com/mattermost/mattermost-server/v6/jobs/import_process"
"github.com/mattermost/mattermost-server/v6/jobs/last_accessible_file"
@@ -1542,6 +1543,12 @@ func (s *Server) initJobs() {
notify_admin.MakeScheduler(s.Jobs, s.License(), model.JobTypeTrialNotifyAdmin),
)
s.Jobs.RegisterJobType(
model.JobTypeHostedPurchaseScreening,
hosted_purchase_screening.MakeWorker(s.Jobs, s.License(), s.Store().System()),
hosted_purchase_screening.MakeScheduler(s.Jobs, s.License()),
)
s.platform.Jobs = s.Jobs
}