diff options
author | Sandro Santilli <strk@kbt.io> | 2016-11-07 16:37:32 +0100 |
---|---|---|
committer | Sandro Santilli <strk@kbt.io> | 2016-11-07 17:05:08 +0100 |
commit | 80eea77953ab5f1f12e1a01f1930b72c360a5c76 (patch) | |
tree | ef36958df6ecdf84f37a9f5c9680f591ba5cc25c /models/action.go | |
parent | 5d430c9e68f7e50e6d1727c43518e84579fd6a4f (diff) | |
download | gitea-80eea77953ab5f1f12e1a01f1930b72c360a5c76.tar.gz gitea-80eea77953ab5f1f12e1a01f1930b72c360a5c76.zip |
Use MixedCase constant names
See https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/models/action.go b/models/action.go index 055bc4b299..96dd2d7680 100644 --- a/models/action.go +++ b/models/action.go @@ -27,21 +27,21 @@ import ( type ActionType int const ( - ACTION_CREATE_REPO ActionType = iota + 1 // 1 - ACTION_RENAME_REPO // 2 - ACTION_STAR_REPO // 3 - ACTION_WATCH_REPO // 4 - ACTION_COMMIT_REPO // 5 - ACTION_CREATE_ISSUE // 6 - ACTION_CREATE_PULL_REQUEST // 7 - ACTION_TRANSFER_REPO // 8 - ACTION_PUSH_TAG // 9 - ACTION_COMMENT_ISSUE // 10 - ACTION_MERGE_PULL_REQUEST // 11 - ACTION_CLOSE_ISSUE // 12 - ACTION_REOPEN_ISSUE // 13 - ACTION_CLOSE_PULL_REQUEST // 14 - ACTION_REOPEN_PULL_REQUEST // 15 + ActionCreateRepo ActionType = iota + 1 // 1 + ActionRenameRepo // 2 + ActionStarRepo // 3 + ActionWatchRepo // 4 + ActionCommitRepo // 5 + ActionCreateIssue // 6 + ActionCreatePullRequest // 7 + ActionTransferRepo // 8 + ActionPushTag // 9 + ActionCommentIssue // 10 + ActionMergePullRequest // 11 + ActionCloseIssue // 12 + ActionReopenIssue // 13 + ActionClosePullRequest // 14 + ActionReopenPullRequest // 15 ) var ( @@ -176,7 +176,7 @@ func newRepoAction(e Engine, u *User, repo *Repository) (err error) { if err = notifyWatchers(e, &Action{ ActUserID: u.ID, ActUserName: u.Name, - OpType: ACTION_CREATE_REPO, + OpType: ActionCreateRepo, RepoID: repo.ID, RepoUserName: repo.Owner.Name, RepoName: repo.Name, @@ -198,7 +198,7 @@ func renameRepoAction(e Engine, actUser *User, oldRepoName string, repo *Reposit if err = notifyWatchers(e, &Action{ ActUserID: actUser.ID, ActUserName: actUser.Name, - OpType: ACTION_RENAME_REPO, + OpType: ActionRenameRepo, RepoID: repo.ID, RepoUserName: repo.Owner.Name, RepoName: repo.Name, @@ -454,10 +454,10 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { } isNewBranch := false - opType := ACTION_COMMIT_REPO + opType := ActionCommitRepo // Check it's tag push or branch. if strings.HasPrefix(opts.RefFullName, git.TAG_PREFIX) { - opType = ACTION_PUSH_TAG + opType = ActionPushTag opts.Commits = &PushCommits{} } else { // if not the first commit, set the compare URL. @@ -503,8 +503,8 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { apiPusher := pusher.APIFormat() apiRepo := repo.APIFormat(nil) switch opType { - case ACTION_COMMIT_REPO: // Push - if err = PrepareWebhooks(repo, HOOK_EVENT_PUSH, &api.PushPayload{ + case ActionCommitRepo: // Push + if err = PrepareWebhooks(repo, HookEventPush, &api.PushPayload{ Ref: opts.RefFullName, Before: opts.OldCommitID, After: opts.NewCommitID, @@ -518,7 +518,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { } if isNewBranch { - return PrepareWebhooks(repo, HOOK_EVENT_CREATE, &api.CreatePayload{ + return PrepareWebhooks(repo, HookEventCreate, &api.CreatePayload{ Ref: refName, RefType: "branch", Repo: apiRepo, @@ -526,8 +526,8 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { }) } - case ACTION_PUSH_TAG: // Create - return PrepareWebhooks(repo, HOOK_EVENT_CREATE, &api.CreatePayload{ + case ActionPushTag: // Create + return PrepareWebhooks(repo, HookEventCreate, &api.CreatePayload{ Ref: refName, RefType: "tag", Repo: apiRepo, @@ -542,7 +542,7 @@ func transferRepoAction(e Engine, doer, oldOwner *User, repo *Repository) (err e if err = notifyWatchers(e, &Action{ ActUserID: doer.ID, ActUserName: doer.Name, - OpType: ACTION_TRANSFER_REPO, + OpType: ActionTransferRepo, RepoID: repo.ID, RepoUserName: repo.Owner.Name, RepoName: repo.Name, @@ -572,7 +572,7 @@ func mergePullRequestAction(e Engine, doer *User, repo *Repository, issue *Issue return notifyWatchers(e, &Action{ ActUserID: doer.ID, ActUserName: doer.Name, - OpType: ACTION_MERGE_PULL_REQUEST, + OpType: ActionMergePullRequest, Content: fmt.Sprintf("%d|%s", issue.Index, issue.Title), RepoID: repo.ID, RepoUserName: repo.Owner.Name, |