]> source.dussan.org Git - gitea.git/commitdiff
Only return JSON for add/remove all (#9028)
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>
Sat, 16 Nov 2019 17:36:13 +0000 (11:36 -0600)
committerzeripath <art27@cantab.net>
Sat, 16 Nov 2019 17:36:13 +0000 (17:36 +0000)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
routers/org/teams.go

index 36a2847355ae57870e0d5da0c3a0d9484b2a16c1..873265803fd43122b6fce1d5aa2fb326db76f093 100644 (file)
@@ -138,7 +138,8 @@ func TeamsRepoAction(ctx *context.Context) {
        }
 
        var err error
-       switch ctx.Params(":action") {
+       action := ctx.Params(":action")
+       switch action {
        case "add":
                repoName := path.Base(ctx.Query("repo_name"))
                var repo *models.Repository
@@ -167,9 +168,12 @@ func TeamsRepoAction(ctx *context.Context) {
                return
        }
 
-       ctx.JSON(200, map[string]interface{}{
-               "redirect": ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories",
-       })
+       if action == "addall" || action == "removeall" {
+               ctx.JSON(200, map[string]interface{}{
+                       "redirect": ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories",
+               })
+               return
+       }
        ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories")
 }