diff options
Diffstat (limited to 'internal/route')
-rw-r--r-- | internal/route/admin/auths.go | 8 | ||||
-rw-r--r-- | internal/route/admin/repos.go | 2 | ||||
-rw-r--r-- | internal/route/admin/users.go | 6 | ||||
-rw-r--r-- | internal/route/api/v1/repo/repo.go | 8 | ||||
-rw-r--r-- | internal/route/api/v1/user/user.go | 4 | ||||
-rw-r--r-- | internal/route/lfs/batch.go | 2 | ||||
-rw-r--r-- | internal/route/org/members.go | 2 | ||||
-rw-r--r-- | internal/route/org/teams.go | 4 | ||||
-rw-r--r-- | internal/route/repo/issue.go | 18 | ||||
-rw-r--r-- | internal/route/repo/release.go | 2 | ||||
-rw-r--r-- | internal/route/repo/repo.go | 2 | ||||
-rw-r--r-- | internal/route/repo/setting.go | 4 | ||||
-rw-r--r-- | internal/route/repo/webhook.go | 2 | ||||
-rw-r--r-- | internal/route/repo/webhook_test.go | 2 | ||||
-rw-r--r-- | internal/route/repo/wiki.go | 2 | ||||
-rw-r--r-- | internal/route/user/setting.go | 12 |
16 files changed, 40 insertions, 40 deletions
diff --git a/internal/route/admin/auths.go b/internal/route/admin/auths.go index 49839dae..a19888bb 100644 --- a/internal/route/admin/auths.go +++ b/internal/route/admin/auths.go @@ -47,7 +47,7 @@ func Authentications(c *context.Context) { type dropdownItem struct { Name string - Type interface{} + Type any } var ( @@ -130,7 +130,7 @@ func NewAuthSourcePost(c *context.Context, f form.Authentication) { c.Data["SMTPAuths"] = smtp.AuthTypes hasTLS := false - var config interface{} + var config any switch auth.Type(f.Type) { case auth.LDAP, auth.DLDAP: config = parseLDAPConfig(f) @@ -284,7 +284,7 @@ func DeleteAuthSource(c *context.Context) { } else { c.Flash.Error(fmt.Sprintf("DeleteSource: %v", err)) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/auths/" + c.Params(":authid"), }) return @@ -292,7 +292,7 @@ func DeleteAuthSource(c *context.Context) { log.Trace("Authentication deleted by admin(%s): %d", c.User.Name, id) c.Flash.Success(c.Tr("admin.auths.deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/auths", }) } diff --git a/internal/route/admin/repos.go b/internal/route/admin/repos.go index c2d2509c..5ae8f749 100644 --- a/internal/route/admin/repos.go +++ b/internal/route/admin/repos.go @@ -81,7 +81,7 @@ func DeleteRepo(c *context.Context) { log.Trace("Repository deleted: %s/%s", repo.MustOwner().Name, repo.Name) c.Flash.Success(c.Tr("repo.settings.deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/repos?page=" + c.Query("page"), }) } diff --git a/internal/route/admin/users.go b/internal/route/admin/users.go index 9b47b5fc..1b49d216 100644 --- a/internal/route/admin/users.go +++ b/internal/route/admin/users.go @@ -230,12 +230,12 @@ func DeleteUser(c *context.Context) { switch { case db.IsErrUserOwnRepos(err): c.Flash.Error(c.Tr("admin.users.still_own_repo")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/users/" + c.Params(":userid"), }) case db.IsErrUserHasOrgs(err): c.Flash.Error(c.Tr("admin.users.still_has_org")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/users/" + c.Params(":userid"), }) default: @@ -246,7 +246,7 @@ func DeleteUser(c *context.Context) { log.Trace("Account deleted by admin (%s): %s", c.User.Name, u.Name) c.Flash.Success(c.Tr("admin.users.deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/users", }) } diff --git a/internal/route/api/v1/repo/repo.go b/internal/route/api/v1/repo/repo.go index c0e3b612..089269ac 100644 --- a/internal/route/api/v1/repo/repo.go +++ b/internal/route/api/v1/repo/repo.go @@ -34,7 +34,7 @@ func Search(c *context.APIContext) { } else { u, err := db.Users.GetByID(c.Req.Context(), opts.OwnerID) if err != nil { - c.JSON(http.StatusInternalServerError, map[string]interface{}{ + c.JSON(http.StatusInternalServerError, map[string]any{ "ok": false, "error": err.Error(), }) @@ -49,7 +49,7 @@ func Search(c *context.APIContext) { repos, count, err := db.SearchRepositoryByName(opts) if err != nil { - c.JSON(http.StatusInternalServerError, map[string]interface{}{ + c.JSON(http.StatusInternalServerError, map[string]any{ "ok": false, "error": err.Error(), }) @@ -57,7 +57,7 @@ func Search(c *context.APIContext) { } if err = db.RepositoryList(repos).LoadAttributes(); err != nil { - c.JSON(http.StatusInternalServerError, map[string]interface{}{ + c.JSON(http.StatusInternalServerError, map[string]any{ "ok": false, "error": err.Error(), }) @@ -70,7 +70,7 @@ func Search(c *context.APIContext) { } c.SetLinkHeader(int(count), opts.PageSize) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, "data": results, }) diff --git a/internal/route/api/v1/user/user.go b/internal/route/api/v1/user/user.go index 10d82b9a..b311f68b 100644 --- a/internal/route/api/v1/user/user.go +++ b/internal/route/api/v1/user/user.go @@ -28,7 +28,7 @@ func Search(c *context.APIContext) { users, _, err := db.SearchUserByName(opts) if err != nil { - c.JSON(http.StatusInternalServerError, map[string]interface{}{ + c.JSON(http.StatusInternalServerError, map[string]any{ "ok": false, "error": err.Error(), }) @@ -48,7 +48,7 @@ func Search(c *context.APIContext) { } } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, "data": results, }) diff --git a/internal/route/lfs/batch.go b/internal/route/lfs/batch.go index bde3140d..a6921648 100644 --- a/internal/route/lfs/batch.go +++ b/internal/route/lfs/batch.go @@ -170,7 +170,7 @@ type responseError struct { const contentType = "application/vnd.git-lfs+json" -func responseJSON(w http.ResponseWriter, status int, v interface{}) { +func responseJSON(w http.ResponseWriter, status int, v any) { w.Header().Set("Content-Type", contentType) w.WriteHeader(status) diff --git a/internal/route/org/members.go b/internal/route/org/members.go index c8516b72..b53034e4 100644 --- a/internal/route/org/members.go +++ b/internal/route/org/members.go @@ -76,7 +76,7 @@ func MembersAction(c *context.Context) { if err != nil { log.Error("Action(%s): %v", c.Params(":action"), err) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": false, "err": err.Error(), }) diff --git a/internal/route/org/teams.go b/internal/route/org/teams.go index 7f932f3f..b99b0a1b 100644 --- a/internal/route/org/teams.go +++ b/internal/route/org/teams.go @@ -91,7 +91,7 @@ func TeamsAction(c *context.Context) { c.Flash.Error(c.Tr("form.last_org_owner")) } else { log.Error("Action(%s): %v", c.Params(":action"), err) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": false, "err": err.Error(), }) @@ -265,7 +265,7 @@ func DeleteTeam(c *context.Context) { c.Flash.Success(c.Tr("org.teams.delete_team_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Org.OrgLink + "/teams", }) } diff --git a/internal/route/repo/issue.go b/internal/route/repo/issue.go index f6a0d1b5..1fd4820e 100644 --- a/internal/route/repo/issue.go +++ b/internal/route/repo/issue.go @@ -719,7 +719,7 @@ func UpdateIssueTitle(c *context.Context) { return } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "title": issue.Title, }) } @@ -778,7 +778,7 @@ func UpdateIssueLabel(c *context.Context) { } } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, }) } @@ -792,7 +792,7 @@ func UpdateIssueMilestone(c *context.Context) { oldMilestoneID := issue.MilestoneID milestoneID := c.QueryInt64("id") if oldMilestoneID == milestoneID { - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, }) return @@ -805,7 +805,7 @@ func UpdateIssueMilestone(c *context.Context) { return } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, }) } @@ -818,7 +818,7 @@ func UpdateIssueAssignee(c *context.Context) { assigneeID := c.QueryInt64("id") if issue.AssigneeID == assigneeID { - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, }) return @@ -829,7 +829,7 @@ func UpdateIssueAssignee(c *context.Context) { return } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "ok": true, }) } @@ -943,7 +943,7 @@ func UpdateCommentContent(c *context.Context) { oldContent := comment.Content comment.Content = c.Query("content") if comment.Content == "" { - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "content": "", }) return @@ -1062,7 +1062,7 @@ func DeleteLabel(c *context.Context) { c.Flash.Success(c.Tr("repo.issues.label_deletion_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Repo.MakeURL("labels"), }) } @@ -1260,7 +1260,7 @@ func DeleteMilestone(c *context.Context) { c.Flash.Success(c.Tr("repo.milestones.deletion_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Repo.MakeURL("milestones"), }) } diff --git a/internal/route/repo/release.go b/internal/route/repo/release.go index f8a90f42..3aabcf02 100644 --- a/internal/route/repo/release.go +++ b/internal/route/repo/release.go @@ -320,7 +320,7 @@ func DeleteRelease(c *context.Context) { c.Flash.Success(c.Tr("repo.release.deletion_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Repo.RepoLink + "/releases", }) } diff --git a/internal/route/repo/repo.go b/internal/route/repo/repo.go index b9f9f988..f19bd3df 100644 --- a/internal/route/repo/repo.go +++ b/internal/route/repo/repo.go @@ -86,7 +86,7 @@ func Create(c *context.Context) { c.Success(CREATE) } -func handleCreateError(c *context.Context, err error, name, tpl string, form interface{}) { +func handleCreateError(c *context.Context, err error, name, tpl string, form any) { switch { case db.IsErrReachLimitOfRepo(err): c.RenderWithErr(c.Tr("repo.form.reach_limit_of_creation", err.(db.ErrReachLimitOfRepo).Limit), tpl, form) diff --git a/internal/route/repo/setting.go b/internal/route/repo/setting.go index c02254ee..b1d4de6a 100644 --- a/internal/route/repo/setting.go +++ b/internal/route/repo/setting.go @@ -429,7 +429,7 @@ func DeleteCollaboration(c *context.Context) { c.Flash.Success(c.Tr("repo.settings.remove_collaborator_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Repo.RepoLink + "/settings/collaboration", }) } @@ -682,7 +682,7 @@ func DeleteDeployKey(c *context.Context) { c.Flash.Success(c.Tr("repo.settings.deploy_key_deletion_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Repo.RepoLink + "/settings/keys", }) } diff --git a/internal/route/repo/webhook.go b/internal/route/repo/webhook.go index 615137bc..7b90a651 100644 --- a/internal/route/repo/webhook.go +++ b/internal/route/repo/webhook.go @@ -591,7 +591,7 @@ func DeleteWebhook(c *context.Context, orCtx *orgRepoContext) { } c.Flash.Success(c.Tr("repo.settings.webhook_deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": orCtx.Link + "/settings/hooks", }) } diff --git a/internal/route/repo/webhook_test.go b/internal/route/repo/webhook_test.go index 784d66ed..3c25ba99 100644 --- a/internal/route/repo/webhook_test.go +++ b/internal/route/repo/webhook_test.go @@ -16,7 +16,7 @@ import ( func Test_validateWebhook(t *testing.T) { l := &mocks.Locale{ MockLang: "en", - MockTr: func(s string, _ ...interface{}) string { + MockTr: func(s string, _ ...any) string { return s }, } diff --git a/internal/route/repo/wiki.go b/internal/route/repo/wiki.go index 70c82626..4ddb92d6 100644 --- a/internal/route/repo/wiki.go +++ b/internal/route/repo/wiki.go @@ -263,7 +263,7 @@ func DeleteWikiPagePost(c *context.Context) { return } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": c.Repo.RepoLink + "/wiki/", }) } diff --git a/internal/route/user/setting.go b/internal/route/user/setting.go index 0f5a62bf..fffefe1d 100644 --- a/internal/route/user/setting.go +++ b/internal/route/user/setting.go @@ -300,7 +300,7 @@ func DeleteEmail(c *context.Context) { } c.Flash.Success(c.Tr("settings.email_deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/user/settings/email", }) } @@ -372,7 +372,7 @@ func DeleteSSHKey(c *context.Context) { c.Flash.Success(c.Tr("settings.ssh_key_deletion_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/user/settings/ssh", }) } @@ -507,7 +507,7 @@ func SettingsTwoFactorDisable(c *context.Context) { } c.Flash.Success(c.Tr("settings.two_factor_disable_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/user/settings/security", }) } @@ -543,7 +543,7 @@ func SettingsLeaveRepo(c *context.Context) { } c.Flash.Success(c.Tr("settings.repos.leave_success", repo.FullName())) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/user/settings/repositories", }) } @@ -572,7 +572,7 @@ func SettingsLeaveOrganization(c *context.Context) { } } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/user/settings/organizations", }) } @@ -630,7 +630,7 @@ func SettingsDeleteApplication(c *context.Context) { c.Flash.Success(c.Tr("settings.delete_token_success")) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/user/settings/applications", }) } |