aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-07-04 20:36:08 +0200
committerGitHub <noreply@github.com>2023-07-04 18:36:08 +0000
commit88f835192d1a554d233b0ec4daa33276b7eb2910 (patch)
tree438140c295791e64a3b78dcfeae57701bcf296c3 /routers/web/org
parent00dbba7f4266032a2b91b760e7c611950ffad096 (diff)
downloadgitea-88f835192d1a554d233b0ec4daa33276b7eb2910.tar.gz
gitea-88f835192d1a554d233b0ec4daa33276b7eb2910.zip
Replace `interface{}` with `any` (#25686)
Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`. Basically the same [as golang did](https://github.com/golang/go/commit/2580d0e08d5e9f979b943758d3c49877fb2324cb).
Diffstat (limited to 'routers/web/org')
-rw-r--r--routers/web/org/members.go10
-rw-r--r--routers/web/org/org_labels.go2
-rw-r--r--routers/web/org/projects.go16
-rw-r--r--routers/web/org/setting.go2
-rw-r--r--routers/web/org/teams.go20
5 files changed, 25 insertions, 25 deletions
diff --git a/routers/web/org/members.go b/routers/web/org/members.go
index 1953a8b284..8da0f0b9fd 100644
--- a/routers/web/org/members.go
+++ b/routers/web/org/members.go
@@ -101,7 +101,7 @@ func MembersAction(ctx *context.Context) {
err = models.RemoveOrgUser(org.ID, uid)
if organization.IsErrLastOrgOwner(err) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/members",
})
return
@@ -110,12 +110,12 @@ func MembersAction(ctx *context.Context) {
err = models.RemoveOrgUser(org.ID, ctx.Doer.ID)
if err == nil {
ctx.Flash.Success(ctx.Tr("form.organization_leave_success", org.DisplayName()))
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": "", // keep the user stay on current page, in case they want to do other operations.
})
} else if organization.IsErrLastOrgOwner(err) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/members",
})
} else {
@@ -126,7 +126,7 @@ func MembersAction(ctx *context.Context) {
if err != nil {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -138,7 +138,7 @@ func MembersAction(ctx *context.Context) {
redirect = setting.AppSubURL + "/"
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": redirect,
})
}
diff --git a/routers/web/org/org_labels.go b/routers/web/org/org_labels.go
index 9ce05680d7..08566637a8 100644
--- a/routers/web/org/org_labels.go
+++ b/routers/web/org/org_labels.go
@@ -90,7 +90,7 @@ func DeleteLabel(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.issues.label_deletion_success"))
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/settings/labels",
})
}
diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go
index c568b1c071..4b33d943b3 100644
--- a/routers/web/org/projects.go
+++ b/routers/web/org/projects.go
@@ -218,7 +218,7 @@ func DeleteProject(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.projects.deletion_success"))
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.ContextUser.HomeLink() + "/-/projects",
})
}
@@ -449,7 +449,7 @@ func UpdateIssueProject(ctx *context.Context) {
}
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -497,7 +497,7 @@ func DeleteProjectBoard(ctx *context.Context) {
return
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -526,7 +526,7 @@ func AddBoardToProjectPost(ctx *context.Context) {
return
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -594,7 +594,7 @@ func EditProjectBoard(ctx *context.Context) {
return
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -611,7 +611,7 @@ func SetDefaultProjectBoard(ctx *context.Context) {
return
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -628,7 +628,7 @@ func UnsetDefaultProjectBoard(ctx *context.Context) {
return
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -730,7 +730,7 @@ func MoveIssues(ctx *context.Context) {
return
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index 2c4a6b93e3..b5653160a2 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -224,7 +224,7 @@ func DeleteWebhook(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/settings/hooks",
})
}
diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go
index 2ce4bf5322..aefadaf809 100644
--- a/routers/web/org/teams.go
+++ b/routers/web/org/teams.go
@@ -79,7 +79,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -95,7 +95,7 @@ func TeamsAction(ctx *context.Context) {
redirect = setting.AppSubURL + "/"
}
ctx.JSON(http.StatusOK,
- map[string]interface{}{
+ map[string]any{
"redirect": redirect,
})
return
@@ -117,7 +117,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -125,7 +125,7 @@ func TeamsAction(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK,
- map[string]interface{}{
+ map[string]any{
"redirect": ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName),
})
return
@@ -199,7 +199,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -256,7 +256,7 @@ func TeamsRepoAction(ctx *context.Context) {
}
if action == "addall" || action == "removeall" {
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName) + "/repositories",
})
return
@@ -414,7 +414,7 @@ func SearchTeam(ctx *context.Context) {
teams, maxResults, err := org_model.SearchTeam(opts)
if err != nil {
log.Error("SearchTeam failed: %v", err)
- ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
+ ctx.JSON(http.StatusInternalServerError, map[string]any{
"ok": false,
"error": "SearchTeam internal failure",
})
@@ -424,7 +424,7 @@ func SearchTeam(ctx *context.Context) {
apiTeams, err := convert.ToTeams(ctx, teams, false)
if err != nil {
log.Error("convert ToTeams failed: %v", err)
- ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
+ ctx.JSON(http.StatusInternalServerError, map[string]any{
"ok": false,
"error": "SearchTeam failed to get units",
})
@@ -432,7 +432,7 @@ func SearchTeam(ctx *context.Context) {
}
ctx.SetTotalCountHeader(maxResults)
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
"data": apiTeams,
})
@@ -530,7 +530,7 @@ func DeleteTeam(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("org.teams.delete_team_success"))
}
- ctx.JSON(http.StatusOK, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/teams",
})
}