aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-06-18 01:24:55 +0200
committerGitHub <noreply@github.com>2021-06-18 01:24:55 +0200
commit75205b5669c86fb1b49daa1805f0987bd5b3cbe2 (patch)
tree74d560cf981769e01b95661e0dcce6f3f2439705 /routers/api
parent29695cd6d511823ab0d233bba8c7971e5dac3e5f (diff)
downloadgitea-75205b5669c86fb1b49daa1805f0987bd5b3cbe2.tar.gz
gitea-75205b5669c86fb1b49daa1805f0987bd5b3cbe2.zip
Fix some API bugs (#16184)
* Repository object only count releases as releases (fix #16144) * EditOrg respect RepoAdminChangeTeamAccess option (fix #16013)
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/org/org.go8
-rw-r--r--routers/api/v1/utils/utils.go2
2 files changed, 8 insertions, 2 deletions
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index e0f36aa1e6..f4a634f4d5 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -264,7 +264,13 @@ func Edit(ctx *context.APIContext) {
if form.Visibility != "" {
org.Visibility = api.VisibilityModes[form.Visibility]
}
- if err := models.UpdateUserCols(org, "full_name", "description", "website", "location", "visibility"); err != nil {
+ if form.RepoAdminChangeTeamAccess != nil {
+ org.RepoAdminChangeTeamAccess = *form.RepoAdminChangeTeamAccess
+ }
+ if err := models.UpdateUserCols(org,
+ "full_name", "description", "website", "location",
+ "visibility", "repo_admin_change_team_access",
+ ); err != nil {
ctx.Error(http.StatusInternalServerError, "EditOrganization", err)
return
}
diff --git a/routers/api/v1/utils/utils.go b/routers/api/v1/utils/utils.go
index ad1a136db4..10ab3ebd0c 100644
--- a/routers/api/v1/utils/utils.go
+++ b/routers/api/v1/utils/utils.go
@@ -55,7 +55,7 @@ func parseTime(value string) (int64, error) {
// prepareQueryArg unescape and trim a query arg
func prepareQueryArg(ctx *context.APIContext, name string) (value string, err error) {
value, err = url.PathUnescape(ctx.Query(name))
- value = strings.Trim(value, " ")
+ value = strings.TrimSpace(value)
return
}