diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-22 23:11:12 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-22 23:11:12 -0400 |
commit | 314193029a246c2498c6d54c085d57f7589c8dbe (patch) | |
tree | 302cacb210a972d8050dbf1882a89c5ace1e6218 /routers/repo | |
parent | 9c820730918443ca2b498dfa71b3131d73cec526 (diff) | |
download | gitea-314193029a246c2498c6d54c085d57f7589c8dbe.tar.gz gitea-314193029a246c2498c6d54c085d57f7589c8dbe.zip |
Use constants to name template file
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/branch.go | 11 | ||||
-rw-r--r-- | routers/repo/commit.go | 92 | ||||
-rw-r--r-- | routers/repo/issue.go | 34 | ||||
-rw-r--r-- | routers/repo/pull.go | 7 | ||||
-rw-r--r-- | routers/repo/release.go | 19 | ||||
-rw-r--r-- | routers/repo/repo.go | 30 | ||||
-rw-r--r-- | routers/repo/setting.go | 67 |
7 files changed, 163 insertions, 97 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 2e2ae69254..9bad7289b9 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -7,22 +7,27 @@ package repo import ( "github.com/go-martini/martini" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" ) +const ( + BRANCH base.TplName = "repo/branch" +) + func Branches(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Branches" ctx.Data["IsRepoToolbarBranches"] = true brs, err := ctx.Repo.GitRepo.GetBranches() if err != nil { - ctx.Handle(500, "repo.Branches", err) + ctx.Handle(500, "repo.Branches(GetBranches)", err) return } else if len(brs) == 0 { - ctx.Handle(404, "repo.Branches", nil) + ctx.Handle(404, "repo.Branches(GetBranches)", nil) return } ctx.Data["Branches"] = brs - ctx.HTML(200, "repo/branches") + ctx.HTML(200, BRANCH) } diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 09dcaf5ead..aa5c22e417 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -14,6 +14,11 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + COMMITS base.TplName = "repo/commits" + DIFF base.TplName = "repo/diff" +) + func Commits(ctx *middleware.Context, params martini.Params) { ctx.Data["IsRepoToolbarCommits"] = true @@ -22,10 +27,10 @@ func Commits(ctx *middleware.Context, params martini.Params) { brs, err := ctx.Repo.GitRepo.GetBranches() if err != nil { - ctx.Handle(500, "repo.Commits", err) + ctx.Handle(500, "repo.Commits(GetBranches)", err) return } else if len(brs) == 0 { - ctx.Handle(404, "repo.Commits", nil) + ctx.Handle(404, "repo.Commits(GetBranches)", nil) return } @@ -61,7 +66,43 @@ func Commits(ctx *middleware.Context, params martini.Params) { ctx.Data["CommitCount"] = commitsCount ctx.Data["LastPageNum"] = lastPage ctx.Data["NextPageNum"] = nextPage - ctx.HTML(200, "repo/commits") + ctx.HTML(200, COMMITS) +} + +func SearchCommits(ctx *middleware.Context, params martini.Params) { + ctx.Data["IsSearchPage"] = true + ctx.Data["IsRepoToolbarCommits"] = true + + keyword := ctx.Query("q") + if len(keyword) == 0 { + ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName) + return + } + + userName := params["username"] + repoName := params["reponame"] + + brs, err := ctx.Repo.GitRepo.GetBranches() + if err != nil { + ctx.Handle(500, "repo.SearchCommits(GetBranches)", err) + return + } else if len(brs) == 0 { + ctx.Handle(404, "repo.SearchCommits(GetBranches)", nil) + return + } + + commits, err := ctx.Repo.Commit.SearchCommits(keyword) + if err != nil { + ctx.Handle(500, "repo.SearchCommits(SearchCommits)", err) + return + } + + ctx.Data["Keyword"] = keyword + ctx.Data["Username"] = userName + ctx.Data["Reponame"] = repoName + ctx.Data["CommitCount"] = commits.Len() + ctx.Data["Commits"] = commits + ctx.HTML(200, COMMITS) } func Diff(ctx *middleware.Context, params martini.Params) { @@ -75,7 +116,7 @@ func Diff(ctx *middleware.Context, params martini.Params) { diff, err := models.GetDiff(models.RepoPath(userName, repoName), commitId) if err != nil { - ctx.Handle(404, "repo.Diff", err) + ctx.Handle(404, "repo.Diff(GetDiff)", err) return } @@ -119,43 +160,7 @@ func Diff(ctx *middleware.Context, params martini.Params) { ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId) ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId) - ctx.HTML(200, "repo/diff") -} - -func SearchCommits(ctx *middleware.Context, params martini.Params) { - ctx.Data["IsSearchPage"] = true - ctx.Data["IsRepoToolbarCommits"] = true - - keyword := ctx.Query("q") - if len(keyword) == 0 { - ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName) - return - } - - userName := params["username"] - repoName := params["reponame"] - - brs, err := ctx.Repo.GitRepo.GetBranches() - if err != nil { - ctx.Handle(500, "repo.SearchCommits(GetBranches)", err) - return - } else if len(brs) == 0 { - ctx.Handle(404, "repo.SearchCommits(GetBranches)", nil) - return - } - - commits, err := ctx.Repo.Commit.SearchCommits(keyword) - if err != nil { - ctx.Handle(500, "repo.SearchCommits(SearchCommits)", err) - return - } - - ctx.Data["Keyword"] = keyword - ctx.Data["Username"] = userName - ctx.Data["Reponame"] = repoName - ctx.Data["CommitCount"] = commits.Len() - ctx.Data["Commits"] = commits - ctx.HTML(200, "repo/commits") + ctx.HTML(200, DIFF) } func FileHistory(ctx *middleware.Context, params martini.Params) { @@ -184,8 +189,7 @@ func FileHistory(ctx *middleware.Context, params martini.Params) { if err != nil { ctx.Handle(500, "repo.FileHistory(GetCommitsCount)", err) return - } - if commitsCount == 0 { + } else if commitsCount == 0 { ctx.Handle(404, "repo.FileHistory", nil) return } @@ -217,5 +221,5 @@ func FileHistory(ctx *middleware.Context, params martini.Params) { ctx.Data["CommitCount"] = commitsCount ctx.Data["LastPageNum"] = lastPage ctx.Data["NextPageNum"] = nextPage - ctx.HTML(200, "repo/commits") + ctx.HTML(200, COMMITS) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 11c573f5cc..cf454bc8fb 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -22,6 +22,16 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + ISSUES base.TplName = "repo/issue/list" + ISSUE_CREATE base.TplName = "repo/issue/create" + ISSUE_VIEW base.TplName = "repo/issue/view" + + MILESTONE base.TplName = "repo/issue/milestone" + MILESTONE_NEW base.TplName = "repo/issue/milestone_new" + MILESTONE_EDIT base.TplName = "repo/issue/milestone_edit" +) + func Issues(ctx *middleware.Context) { ctx.Data["Title"] = "Issues" ctx.Data["IsRepoToolbarIssues"] = true @@ -134,7 +144,7 @@ func Issues(ctx *middleware.Context) { } else { ctx.Data["ShowCount"] = issueStats.OpenCount } - ctx.HTML(200, "issue/list") + ctx.HTML(200, ISSUES) } func CreateIssue(ctx *middleware.Context, params martini.Params) { @@ -161,7 +171,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params) { return } ctx.Data["Collaborators"] = us - ctx.HTML(200, "issue/create") + ctx.HTML(200, ISSUE_CREATE) } func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { @@ -190,7 +200,7 @@ func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.C ctx.Data["Collaborators"] = us if ctx.HasError() { - ctx.HTML(200, "issue/create") + ctx.HTML(200, ISSUE_CREATE) return } @@ -392,7 +402,7 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { ctx.Data["IsIssueOwner"] = ctx.Repo.IsOwner || (ctx.IsSigned && issue.PosterId == ctx.User.Id) ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = false - ctx.HTML(200, "issue/view") + ctx.HTML(200, ISSUE_VIEW) } func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { @@ -794,14 +804,14 @@ func Milestones(ctx *middleware.Context) { } else { ctx.Data["State"] = "open" } - ctx.HTML(200, "issue/milestone") + ctx.HTML(200, MILESTONE) } func NewMilestone(ctx *middleware.Context) { ctx.Data["Title"] = "New Milestone" ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = true - ctx.HTML(200, "issue/milestone_new") + ctx.HTML(200, MILESTONE_NEW) } func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { @@ -809,6 +819,11 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = true + if ctx.HasError() { + ctx.HTML(200, MILESTONE_NEW) + return + } + var deadline time.Time var err error if len(form.Deadline) == 0 { @@ -890,7 +905,7 @@ func UpdateMilestone(ctx *middleware.Context, params martini.Params) { } ctx.Data["Milestone"] = mile - ctx.HTML(200, "issue/milestone_edit") + ctx.HTML(200, MILESTONE_EDIT) } func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form auth.CreateMilestoneForm) { @@ -914,6 +929,11 @@ func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form au return } + if ctx.HasError() { + ctx.HTML(200, MILESTONE_EDIT) + return + } + var deadline time.Time if len(form.Deadline) == 0 { form.Deadline = "12/31/9999" diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 430c6a815f..db208f9fbc 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -7,10 +7,15 @@ package repo import ( "github.com/go-martini/martini" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" ) +const ( + PULLS base.TplName = "repo/pulls" +) + func Pulls(ctx *middleware.Context, params martini.Params) { ctx.Data["IsRepoToolbarPulls"] = true - ctx.HTML(200, "repo/pulls") + ctx.HTML(200, PULLS) } diff --git a/routers/repo/release.go b/routers/repo/release.go index b6149b63a2..a901436fc0 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -14,6 +14,12 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + RELEASES base.TplName = "repo/release/list" + RELEASE_NEW base.TplName = "repo/release/new" + RELEASE_EDIT base.TplName = "repo/release/edit" +) + func Releases(ctx *middleware.Context) { ctx.Data["Title"] = "Releases" ctx.Data["IsRepoToolbarReleases"] = true @@ -100,7 +106,7 @@ func Releases(ctx *middleware.Context) { } models.SortReleases(tags) ctx.Data["Releases"] = tags - ctx.HTML(200, "release/list") + ctx.HTML(200, RELEASES) } func NewRelease(ctx *middleware.Context) { @@ -112,7 +118,7 @@ func NewRelease(ctx *middleware.Context) { ctx.Data["Title"] = "New Release" ctx.Data["IsRepoToolbarReleases"] = true ctx.Data["IsRepoReleaseNew"] = true - ctx.HTML(200, "release/new") + ctx.HTML(200, RELEASE_NEW) } func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { @@ -126,7 +132,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { ctx.Data["IsRepoReleaseNew"] = true if ctx.HasError() { - ctx.HTML(200, "release/new") + ctx.HTML(200, RELEASE_NEW) return } @@ -187,7 +193,7 @@ func EditRelease(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Edit Release" ctx.Data["IsRepoToolbarReleases"] = true - ctx.HTML(200, "release/edit") + ctx.HTML(200, RELEASE_EDIT) } func EditReleasePost(ctx *middleware.Context, params martini.Params, form auth.EditReleaseForm) { @@ -208,6 +214,11 @@ func EditReleasePost(ctx *middleware.Context, params martini.Params, form auth.E } ctx.Data["Release"] = rel + if ctx.HasError() { + ctx.HTML(200, RELEASE_EDIT) + return + } + ctx.Data["Title"] = "Edit Release" ctx.Data["IsRepoToolbarReleases"] = true diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 6154eede38..2ead24df36 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -25,12 +25,18 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + CREATE base.TplName = "repo/create" + MIGRATE base.TplName = "repo/migrate" + SINGLE base.TplName = "repo/single" +) + func Create(ctx *middleware.Context) { ctx.Data["Title"] = "Create repository" ctx.Data["PageIsNewRepo"] = true ctx.Data["LanguageIgns"] = models.LanguageIgns ctx.Data["Licenses"] = models.Licenses - ctx.HTML(200, "repo/create") + ctx.HTML(200, CREATE) } func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { @@ -40,7 +46,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Data["Licenses"] = models.Licenses if ctx.HasError() { - ctx.HTML(200, "repo/create") + ctx.HTML(200, CREATE) return } @@ -51,25 +57,25 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { - ctx.RenderWithErr("Repository name has already been used", "repo/create", &form) + ctx.RenderWithErr("Repository name has already been used", CREATE, &form) return } else if err == models.ErrRepoNameIllegal { - ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/create", &form) + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), CREATE, &form) return } if repo != nil { if errDelete := models.DeleteRepository(ctx.User.Id, repo.Id, ctx.User.Name); errDelete != nil { - log.Error("repo.MigratePost(CreatePost): %v", errDelete) + log.Error("repo.CreatePost(DeleteRepository): %v", errDelete) } } - ctx.Handle(500, "repo.Create", err) + ctx.Handle(500, "repo.CreatePost", err) } func Migrate(ctx *middleware.Context) { ctx.Data["Title"] = "Migrate repository" ctx.Data["PageIsNewRepo"] = true - ctx.HTML(200, "repo/migrate") + ctx.HTML(200, MIGRATE) } func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { @@ -77,7 +83,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.Data["PageIsNewRepo"] = true if ctx.HasError() { - ctx.HTML(200, "repo/migrate") + ctx.HTML(200, MIGRATE) return } @@ -91,10 +97,10 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { - ctx.RenderWithErr("Repository name has already been used", "repo/migrate", &form) + ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form) return } else if err == models.ErrRepoNameIllegal { - ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/migrate", &form) + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form) return } @@ -105,7 +111,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { } if strings.Contains(err.Error(), "Authentication failed") { - ctx.RenderWithErr(err.Error(), "repo/migrate", &form) + ctx.RenderWithErr(err.Error(), MIGRATE, &form) return } ctx.Handle(500, "repo.Migrate", err) @@ -291,7 +297,7 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Data["Treenames"] = treenames ctx.Data["TreePath"] = treePath ctx.Data["BranchLink"] = branchLink - ctx.HTML(200, "repo/single") + ctx.HTML(200, SINGLE) } func basicEncode(username, password string) string { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 6313971c24..6479cb3041 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -20,10 +20,19 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + SETTING base.TplName = "repo/setting" + COLLABORATION base.TplName = "repo/collaboration" + + HOOKS base.TplName = "repo/hooks" + HOOK_ADD base.TplName = "repo/hook_add" + HOOK_EDIT base.TplName = "repo/hook_edit" +) + func Setting(ctx *middleware.Context) { ctx.Data["IsRepoToolbarSetting"] = true ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - settings" - ctx.HTML(200, "repo/setting") + ctx.HTML(200, SETTING) } func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { @@ -32,7 +41,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { switch ctx.Query("action") { case "update": if ctx.HasError() { - ctx.HTML(200, "repo/setting") + ctx.HTML(200, SETTING) return } @@ -44,7 +53,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Handle(500, "setting.SettingPost(update: check existence)", err) return } else if isExist { - ctx.RenderWithErr("Repository name has been taken in your repositories.", "repo/setting", nil) + ctx.RenderWithErr("Repository name has been taken in your repositories.", SETTING, nil) return } else if err = models.ChangeRepositoryName(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newRepoName); err != nil { ctx.Handle(500, "setting.SettingPost(change repository name)", err) @@ -84,7 +93,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Redirect(fmt.Sprintf("/%s/%s/settings", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)) case "transfer": if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") { - ctx.RenderWithErr("Please make sure you entered repository name is correct.", "repo/setting", nil) + ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil) return } else if ctx.Repo.Repository.IsMirror { ctx.Error(404) @@ -98,7 +107,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Handle(500, "setting.SettingPost(transfer: check existence)", err) return } else if !isExist { - ctx.RenderWithErr("Please make sure you entered owner name is correct.", "repo/setting", nil) + ctx.RenderWithErr("Please make sure you entered owner name is correct.", SETTING, nil) return } else if err = models.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository); err != nil { ctx.Handle(500, "setting.SettingPost(transfer repository)", err) @@ -109,7 +118,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Redirect("/") case "delete": if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") { - ctx.RenderWithErr("Please make sure you entered repository name is correct.", "repo/setting", nil) + ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil) return } @@ -156,7 +165,7 @@ func Collaboration(ctx *middleware.Context) { } ctx.Data["Collaborators"] = us - ctx.HTML(200, "repo/collaboration") + ctx.HTML(200, COLLABORATION) } func CollaborationPost(ctx *middleware.Context) { @@ -226,13 +235,13 @@ func WebHooks(ctx *middleware.Context) { } ctx.Data["Webhooks"] = ws - ctx.HTML(200, "repo/hooks") + ctx.HTML(200, HOOKS) } func WebHooksAdd(ctx *middleware.Context) { ctx.Data["IsRepoToolbarWebHooks"] = true ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook" - ctx.HTML(200, "repo/hooks_add") + ctx.HTML(200, HOOK_ADD) } func WebHooksAddPost(ctx *middleware.Context, form auth.NewWebhookForm) { @@ -240,7 +249,7 @@ func WebHooksAddPost(ctx *middleware.Context, form auth.NewWebhookForm) { ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook" if ctx.HasError() { - ctx.HTML(200, "repo/hooks_add") + ctx.HTML(200, HOOK_ADD) return } @@ -293,40 +302,46 @@ func WebHooksEdit(ctx *middleware.Context, params martini.Params) { w.GetEvent() ctx.Data["Webhook"] = w - ctx.HTML(200, "repo/hooks_edit") + ctx.HTML(200, HOOK_EDIT) } func WebHooksEditPost(ctx *middleware.Context, params martini.Params, form auth.NewWebhookForm) { ctx.Data["IsRepoToolbarWebHooks"] = true ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhook" - if ctx.HasError() { - ctx.HTML(200, "repo/hooks_add") - return - } - hookId, _ := base.StrTo(params["id"]).Int64() if hookId == 0 { ctx.Handle(404, "setting.WebHooksEditPost", nil) return } + w, err := models.GetWebhookById(hookId) + if err != nil { + if err == models.ErrWebhookNotExist { + ctx.Handle(404, "setting.WebHooksEditPost(GetWebhookById)", nil) + } else { + ctx.Handle(500, "setting.WebHooksEditPost(GetWebhookById)", err) + } + return + } + + if ctx.HasError() { + ctx.HTML(200, HOOK_EDIT) + return + } + ct := models.JSON if form.ContentType == "2" { ct = models.FORM } - w := &models.Webhook{ - Id: hookId, - RepoId: ctx.Repo.Repository.Id, - Url: form.Url, - ContentType: ct, - Secret: form.Secret, - HookEvent: &models.HookEvent{ - PushOnly: form.PushOnly, - }, - IsActive: form.Active, + w.Url = form.Url + w.ContentType = ct + w.Secret = form.Secret + w.HookEvent = &models.HookEvent{ + PushOnly: form.PushOnly, } + w.IsActive = form.Active if err := w.UpdateEvent(); err != nil { ctx.Handle(500, "setting.WebHooksEditPost(UpdateEvent)", err) return |