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: only update if enabled (#3416)
p0ny9661a5c76461
diff --git a/server/setting.go b/server/setting.goindex acff6731eb..aeb761704b 100644--- a/server/setting.go+++ b/server/setting.go@@ -71,22 +71,24 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {if value.ExternalApproval.Enabled && !s.feature(api.FeatureIMApproval) {return echo.NewHTTPError(http.StatusBadRequest, api.FeatureIMApproval.AccessErrorMessage())}- p := s.ApplicationRunner.p- // clear token cache so that we won't use the previous token.- p.ClearTokenCache()- approvalCode, err := p.CreateApprovalDefinition(ctx, feishu.TokenCtx{- AppID: value.AppID,- AppSecret: value.AppSecret,- }, "")- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create approval definition").SetInternal(err)- }- value.ExternalApproval.ApprovalCode = approvalCode- b, err := json.Marshal(value)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal updated setting value").SetInternal(err)+ if value.ExternalApproval.Enabled {+ p := s.ApplicationRunner.p+ // clear token cache so that we won't use the previous token.+ p.ClearTokenCache()+ approvalCode, err := p.CreateApprovalDefinition(ctx, feishu.TokenCtx{+ AppID: value.AppID,+ AppSecret: value.AppSecret,+ }, "")+ if err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create approval definition").SetInternal(err)+ }+ value.ExternalApproval.ApprovalCode = approvalCode+ b, err := json.Marshal(value)+ if err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal updated setting value").SetInternal(err)+ }+ settingPatch.Value = string(b)}- settingPatch.Value = string(b)}setting, err := s.store.PatchSetting(ctx, settingPatch)