summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-09-19 18:22:42 -0700
committerLunny Xiao <xiaolunwen@gmail.com>2017-09-20 09:22:42 +0800
commitacecedc410537667be33df4546e3004d7ddc825f (patch)
tree645f54b7b46190607e45a4a0b6db7b59801a9c34 /modules
parent4eed85db56f94385bea35f148e6b981644ea1f22 (diff)
downloadgitea-acecedc410537667be33df4546e3004d7ddc825f.tar.gz
gitea-acecedc410537667be33df4546e3004d7ddc825f.zip
Use named ActionType constants in template helper (#2545)
Diffstat (limited to 'modules')
-rw-r--r--modules/templates/helper.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 181d3ff159..e9613b5445 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -277,7 +277,7 @@ func RenderCommitMessage(full bool, msg, urlPrefix string, metas map[string]stri
// Actioner describes an action
type Actioner interface {
- GetOpType() int
+ GetOpType() models.ActionType
GetActUserName() string
GetRepoUserName() string
GetRepoName() string
@@ -289,25 +289,24 @@ type Actioner interface {
GetIssueInfos() []string
}
-// ActionIcon accepts a int that represents action operation type
-// and returns a icon class name.
-func ActionIcon(opType int) string {
+// ActionIcon accepts an action operation type and returns an icon class name.
+func ActionIcon(opType models.ActionType) string {
switch opType {
- case 1, 8: // Create and transfer repository
+ case models.ActionCreateRepo, models.ActionTransferRepo:
return "repo"
- case 5, 9: // Commit repository
+ case models.ActionCommitRepo, models.ActionPushTag:
return "git-commit"
- case 6: // Create issue
+ case models.ActionCreateIssue:
return "issue-opened"
- case 7: // New pull request
+ case models.ActionCreatePullRequest:
return "git-pull-request"
- case 10: // Comment issue
+ case models.ActionCommentIssue:
return "comment-discussion"
- case 11: // Merge pull request
+ case models.ActionMergePullRequest:
return "git-merge"
- case 12, 14: // Close issue or pull request
+ case models.ActionCloseIssue, models.ActionClosePullRequest:
return "issue-closed"
- case 13, 15: // Reopen issue or pull request
+ case models.ActionReopenIssue, models.ActionReopenPullRequest:
return "issue-reopened"
default:
return "invalid type"