]> source.dussan.org Git - gitea.git/commitdiff
Fix feed push tag (#14064)
authorLunny Xiao <xiaolunwen@gmail.com>
Sat, 19 Dec 2020 23:46:28 +0000 (07:46 +0800)
committerGitHub <noreply@github.com>
Sat, 19 Dec 2020 23:46:28 +0000 (07:46 +0800)
* Fix dashboard feed bug when push tag

* Fix variable name

* Fix delete tag

Co-authored-by: 6543 <6543@obermui.de>
models/action.go
templates/user/dashboard/feeds.tmpl

index e702a4263c9f1165c4b44ee7be7d8bb620e7d901..5546409241cb4f6a456341d70e425286be67189e 100644 (file)
@@ -242,6 +242,11 @@ func (a *Action) GetBranch() string {
        return strings.TrimPrefix(a.RefName, git.BranchPrefix)
 }
 
+// GetTag returns the action's repository tag.
+func (a *Action) GetTag() string {
+       return strings.TrimPrefix(a.RefName, git.TagPrefix)
+}
+
 // GetContent returns the action's content.
 func (a *Action) GetContent() string {
        return a.Content
index b28c7c9a0bc61fcc2e7bb3566f692d22dbc9622c..ead8e76f31994614eeb6b937bf14fb62a3ccdfbd 100644 (file)
@@ -28,8 +28,8 @@
                                                {{else if eq .GetOpType 8}}
                                                        {{$.i18n.Tr "action.transfer_repo" .GetContent .GetRepoLink .ShortRepoPath | Str2html}}
                                                {{else if eq .GetOpType 9}}
-                                                       {{ $branchLink := .GetBranch | EscapePound | Escape}}
-                                                       {{$.i18n.Tr "action.push_tag" .GetRepoLink $branchLink .ShortRepoPath | Str2html}}
+                                                       {{ $tagLink := .GetTag | EscapePound | Escape}}
+                                                       {{$.i18n.Tr "action.push_tag" .GetRepoLink $tagLink .ShortRepoPath | Str2html}}
                                                {{else if eq .GetOpType 10}}
                                                        {{ $index := index .GetIssueInfos 0}}
                                                        {{$.i18n.Tr "action.comment_issue" .GetRepoLink $index .ShortRepoPath | Str2html}}
@@ -50,7 +50,7 @@
                                                        {{$.i18n.Tr "action.reopen_pull_request" .GetRepoLink $index .ShortRepoPath | Str2html}}
                                                {{else if eq .GetOpType 16}}
                                                        {{ $index := index .GetIssueInfos 0}}
-                                                       {{$.i18n.Tr "action.delete_tag" .GetRepoLink (.GetBranch|Escape) .ShortRepoPath | Str2html}}
+                                                       {{$.i18n.Tr "action.delete_tag" .GetRepoLink (.GetTag|Escape) .ShortRepoPath | Str2html}}
                                                {{else if eq .GetOpType 17}}
                                                        {{ $index := index .GetIssueInfos 0}}
                                                        {{$.i18n.Tr "action.delete_branch" .GetRepoLink (.GetBranch|Escape) .ShortRepoPath | Str2html}}