Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: avoid duplicate trial request (#3706)
ecmadao1640b4eba809
diff --git a/server/subscription.go b/server/subscription.goindex f8aa2e4003..7285d57102 100644--- a/server/subscription.go+++ b/server/subscription.go@@ -71,8 +71,16 @@ func (s *Server) registerSubscriptionRoutes(g *echo.Group) {subscription := s.licenseService.LoadSubscription(ctx)basePlan := subscription.Plan- upgradeTrial := subscription.Trialing && license.Plan.Priority() > subscription.Plan.Priority()- if upgradeTrial {+ if license.Plan.Priority() <= subscription.Plan.Priority() {+ // Ignore the request if the priority for the trial plan is lower than the current plan.+ c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)+ if err := jsonapi.MarshalPayload(c.Response().Writer, &subscription); err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal subscription response").SetInternal(err)+ }+ return nil+ }++ if subscription.Trialing {license.ExpiresTs = subscription.ExpiresTslicense.IssuedTs = subscription.StartedTs}@@ -103,7 +111,7 @@ func (s *Server) registerSubscriptionRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create license").SetInternal(err)}- if created && upgradeTrial {+ if created && subscription.Trialing {// For trial upgrade// Case 1: Users just have the SettingEnterpriseTrial, don't upload their license in SettingEnterpriseLicense.// Case 2: Users have the SettingEnterpriseLicense with team plan and trialing status.