Fix mirror sync event display in dashboard

This commit is contained in:
Lauris Bukšis-Haberkorns 2018-06-11 10:19:52 +03:00
parent 22271a8270
commit f9f9c20810
4 changed files with 18 additions and 7 deletions

View File

@ -47,9 +47,9 @@ const (
ActionReopenPullRequest // 15 ActionReopenPullRequest // 15
ActionDeleteTag // 16 ActionDeleteTag // 16
ActionDeleteBranch // 17 ActionDeleteBranch // 17
ActionMirrorSyncPush // 20 ActionMirrorSyncPush // 18
ActionMirrorSyncCreate // 21 ActionMirrorSyncCreate // 19
ActionMirrorSyncDelete // 22 ActionMirrorSyncDelete // 20
) )
var ( var (

View File

@ -345,8 +345,7 @@ func ActionIcon(opType models.ActionType) string {
switch opType { switch opType {
case models.ActionCreateRepo, models.ActionTransferRepo: case models.ActionCreateRepo, models.ActionTransferRepo:
return "repo" return "repo"
case models.ActionCommitRepo, models.ActionPushTag, models.ActionDeleteTag, models.ActionDeleteBranch, case models.ActionCommitRepo, models.ActionPushTag, models.ActionDeleteTag, models.ActionDeleteBranch:
models.ActionMirrorSyncPush, models.ActionMirrorSyncCreate, models.ActionMirrorSyncDelete:
return "git-commit" return "git-commit"
case models.ActionCreateIssue: case models.ActionCreateIssue:
return "issue-opened" return "issue-opened"
@ -360,6 +359,8 @@ func ActionIcon(opType models.ActionType) string {
return "issue-closed" return "issue-closed"
case models.ActionReopenIssue, models.ActionReopenPullRequest: case models.ActionReopenIssue, models.ActionReopenPullRequest:
return "issue-reopened" return "issue-reopened"
case models.ActionMirrorSyncPush, models.ActionMirrorSyncCreate, models.ActionMirrorSyncDelete:
return "repo-clone"
default: default:
return "invalid type" return "invalid type"
} }

View File

@ -1595,6 +1595,9 @@ push_tag = pushed tag <a href="%s/src/%s">%[2]s</a> to <a href="%[1]s">%[3]s</a>
delete_tag = deleted tag %[2]s from <a href="%[1]s">%[3]s</a> delete_tag = deleted tag %[2]s from <a href="%[1]s">%[3]s</a>
delete_branch = deleted branch %[2]s from <a href="%[1]s">%[3]s</a> delete_branch = deleted branch %[2]s from <a href="%[1]s">%[3]s</a>
compare_commits = Compare %d commits compare_commits = Compare %d commits
mirror_sync_push = synced commits to <a href="%[1]s/src/%[2]s">%[3]s</a> at <a href="%[1]s">%[4]s</a> from mirror
mirror_sync_create = synced new reference <a href="%s/src/%s">%[2]s</a> to <a href="%[1]s">%[3]s</a> from mirror
mirror_sync_delete = synced and deleted reference <code>%[2]s</code> at <a href="%[1]s">%[3]s</a> from mirror
[tool] [tool]
ago = %s ago ago = %s ago

View File

@ -5,7 +5,7 @@
</div> </div>
<div class="ui grid"> <div class="ui grid">
<div class="ui thirteen wide column"> <div class="ui thirteen wide column">
<div class="{{if eq .GetOpType 5}}push news{{end}}"> <div class="{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}push news{{end}}">
<p> <p>
<a href="{{AppSubUrl}}/{{.GetActUserName}}">{{.ShortActUserName}}</a> <a href="{{AppSubUrl}}/{{.GetActUserName}}">{{.ShortActUserName}}</a>
{{if eq .GetOpType 1}} {{if eq .GetOpType 1}}
@ -49,9 +49,16 @@
{{else if eq .GetOpType 17}} {{else if eq .GetOpType 17}}
{{ $index := index .GetIssueInfos 0}} {{ $index := index .GetIssueInfos 0}}
{{$.i18n.Tr "action.delete_branch" .GetRepoLink .GetBranch .ShortRepoPath | Str2html}} {{$.i18n.Tr "action.delete_branch" .GetRepoLink .GetBranch .ShortRepoPath | Str2html}}
{{else if eq .GetOpType 18}}
{{ $branchLink := .GetBranch | EscapePound}}
{{$.i18n.Tr "action.mirror_sync_push" .GetRepoLink $branchLink .GetBranch .ShortRepoPath | Str2html}}
{{else if eq .GetOpType 19}}
{{$.i18n.Tr "action.mirror_sync_create" .GetRepoLink .GetBranch .ShortRepoPath | Str2html}}
{{else if eq .GetOpType 20}}
{{$.i18n.Tr "action.mirror_sync_delete" .GetRepoLink .GetBranch .ShortRepoPath | Str2html}}
{{end}} {{end}}
</p> </p>
{{if eq .GetOpType 5}} {{if or (eq .GetOpType 5) (eq .GetOpType 18)}}
<div class="content"> <div class="content">
<ul> <ul>
{{ $push := ActionContent2Commits .}} {{ $push := ActionContent2Commits .}}