From 190bd0accd3788c91605bd7092a46a3c778a21fd Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 20 Feb 2021 11:17:51 +0100 Subject: [PATCH] Export LFS & TimeTracking function status (#14753) --- integrations/api_settings_test.go | 8 +++++--- modules/structs/settings.go | 8 +++++--- routers/api/v1/settings/settings.go | 8 +++++--- templates/swagger/v1_json.tmpl | 8 ++++++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/integrations/api_settings_test.go b/integrations/api_settings_test.go index 19a0053876..fdd8b02d62 100644 --- a/integrations/api_settings_test.go +++ b/integrations/api_settings_test.go @@ -43,9 +43,11 @@ func TestAPIExposedSettings(t *testing.T) { DecodeJSON(t, resp, &repo) assert.EqualValues(t, &api.GeneralRepoSettings{ - MirrorsDisabled: setting.Repository.DisableMirrors, - HTTPGitDisabled: setting.Repository.DisableHTTPGit, - MigrationsDisabled: setting.Repository.DisableMigrations, + MirrorsDisabled: setting.Repository.DisableMirrors, + HTTPGitDisabled: setting.Repository.DisableHTTPGit, + MigrationsDisabled: setting.Repository.DisableMigrations, + TimeTrackingDisabled: false, + LFSDisabled: !setting.LFS.StartServer, }, repo) attachment := new(api.GeneralAttachmentSettings) diff --git a/modules/structs/settings.go b/modules/structs/settings.go index 5fd916affe..e15c750356 100644 --- a/modules/structs/settings.go +++ b/modules/structs/settings.go @@ -6,9 +6,11 @@ package structs // GeneralRepoSettings contains global repository settings exposed by API type GeneralRepoSettings struct { - MirrorsDisabled bool `json:"mirrors_disabled"` - HTTPGitDisabled bool `json:"http_git_disabled"` - MigrationsDisabled bool `json:"migrations_disabled"` + MirrorsDisabled bool `json:"mirrors_disabled"` + HTTPGitDisabled bool `json:"http_git_disabled"` + MigrationsDisabled bool `json:"migrations_disabled"` + TimeTrackingDisabled bool `json:"time_tracking_disabled"` + LFSDisabled bool `json:"lfs_disabled"` } // GeneralUISettings contains global ui settings exposed by API diff --git a/routers/api/v1/settings/settings.go b/routers/api/v1/settings/settings.go index 6095988404..cfb059a3ac 100644 --- a/routers/api/v1/settings/settings.go +++ b/routers/api/v1/settings/settings.go @@ -57,9 +57,11 @@ func GetGeneralRepoSettings(ctx *context.APIContext) { // "200": // "$ref": "#/responses/GeneralRepoSettings" ctx.JSON(http.StatusOK, api.GeneralRepoSettings{ - MirrorsDisabled: setting.Repository.DisableMirrors, - HTTPGitDisabled: setting.Repository.DisableHTTPGit, - MigrationsDisabled: setting.Repository.DisableMigrations, + MirrorsDisabled: setting.Repository.DisableMirrors, + HTTPGitDisabled: setting.Repository.DisableHTTPGit, + MigrationsDisabled: setting.Repository.DisableMigrations, + TimeTrackingDisabled: !setting.Service.EnableTimetracking, + LFSDisabled: !setting.LFS.StartServer, }) } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 71caee9c75..4a97650e56 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -14101,6 +14101,10 @@ "type": "boolean", "x-go-name": "HTTPGitDisabled" }, + "lfs_disabled": { + "type": "boolean", + "x-go-name": "LFSDisabled" + }, "migrations_disabled": { "type": "boolean", "x-go-name": "MigrationsDisabled" @@ -14108,6 +14112,10 @@ "mirrors_disabled": { "type": "boolean", "x-go-name": "MirrorsDisabled" + }, + "time_tracking_disabled": { + "type": "boolean", + "x-go-name": "TimeTrackingDisabled" } }, "x-go-package": "code.gitea.io/gitea/modules/structs"