| @@ -76,7 +76,7 @@ type HookEvent struct { | |||||
| type HookStatus int | type HookStatus int | ||||
| const ( | const ( | ||||
| HOOK_STATUS_NONE = iota | |||||
| HookStatusNone = iota | |||||
| HookStatusSucceed | HookStatusSucceed | ||||
| HookStatusFail | HookStatusFail | ||||
| ) | ) | ||||
| @@ -22,7 +22,7 @@ const ( | |||||
| SETTINGS_OPTIONS base.TplName = "repo/settings/options" | SETTINGS_OPTIONS base.TplName = "repo/settings/options" | ||||
| COLLABORATION base.TplName = "repo/settings/collaboration" | COLLABORATION base.TplName = "repo/settings/collaboration" | ||||
| GITHOOKS base.TplName = "repo/settings/githooks" | GITHOOKS base.TplName = "repo/settings/githooks" | ||||
| GITHOOK_EDIT base.TplName = "repo/settings/githook_edit" | |||||
| GithookEdit base.TplName = "repo/settings/githook_edit" | |||||
| DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys" | DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys" | ||||
| ) | ) | ||||
| @@ -425,7 +425,7 @@ func GitHooksEdit(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Data["Hook"] = hook | ctx.Data["Hook"] = hook | ||||
| ctx.HTML(200, GITHOOK_EDIT) | |||||
| ctx.HTML(200, GithookEdit) | |||||
| } | } | ||||
| func GitHooksEditPost(ctx *context.Context) { | func GitHooksEditPost(ctx *context.Context) { | ||||
| @@ -24,8 +24,8 @@ import ( | |||||
| const ( | const ( | ||||
| HOOKS base.TplName = "repo/settings/hooks" | HOOKS base.TplName = "repo/settings/hooks" | ||||
| HOOK_NEW base.TplName = "repo/settings/hook_new" | |||||
| ORG_HOOK_NEW base.TplName = "org/settings/hook_new" | |||||
| HookNew base.TplName = "repo/settings/hook_new" | |||||
| ORG_HookNew base.TplName = "org/settings/hook_new" | |||||
| ) | ) | ||||
| func Webhooks(ctx *context.Context) { | func Webhooks(ctx *context.Context) { | ||||
| @@ -57,7 +57,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) { | |||||
| return &OrgRepoCtx{ | return &OrgRepoCtx{ | ||||
| RepoID: ctx.Repo.Repository.ID, | RepoID: ctx.Repo.Repository.ID, | ||||
| Link: ctx.Repo.RepoLink, | Link: ctx.Repo.RepoLink, | ||||
| NewTemplate: HOOK_NEW, | |||||
| NewTemplate: HookNew, | |||||
| }, nil | }, nil | ||||
| } | } | ||||
| @@ -65,7 +65,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) { | |||||
| return &OrgRepoCtx{ | return &OrgRepoCtx{ | ||||
| OrgID: ctx.Org.Organization.ID, | OrgID: ctx.Org.Organization.ID, | ||||
| Link: ctx.Org.OrgLink, | Link: ctx.Org.OrgLink, | ||||
| NewTemplate: ORG_HOOK_NEW, | |||||
| NewTemplate: ORG_HookNew, | |||||
| }, nil | }, nil | ||||
| } | } | ||||
| @@ -102,13 +102,13 @@ func ListHooks(repoPath string) (_ []*Hook, err error) { | |||||
| } | } | ||||
| const ( | const ( | ||||
| HOOK_PATH_UPDATE = "hooks/update" | |||||
| HookPathUpdate = "hooks/update" | |||||
| ) | ) | ||||
| // SetUpdateHook writes given content to update hook of the reposiotry. | // SetUpdateHook writes given content to update hook of the reposiotry. | ||||
| func SetUpdateHook(repoPath, content string) (err error) { | func SetUpdateHook(repoPath, content string) (err error) { | ||||
| log("Setting update hook: %s", repoPath) | log("Setting update hook: %s", repoPath) | ||||
| hookPath := path.Join(repoPath, HOOK_PATH_UPDATE) | |||||
| hookPath := path.Join(repoPath, HookPathUpdate) | |||||
| if com.IsExist(hookPath) { | if com.IsExist(hookPath) { | ||||
| err = os.Remove(hookPath) | err = os.Remove(hookPath) | ||||
| } else { | } else { | ||||