aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-12-20 07:46:28 +0800
committerGitHub <noreply@github.com>2020-12-20 07:46:28 +0800
commit36bd5d70cd390d59d1440b2e68bd3170d6af7ca2 (patch)
tree77de5c32ef418f0bd463db85d8dd1a9616380434
parente6744782276fd44181a99d5b818fb3e5ba54f5a5 (diff)
downloadgitea-36bd5d70cd390d59d1440b2e68bd3170d6af7ca2.tar.gz
gitea-36bd5d70cd390d59d1440b2e68bd3170d6af7ca2.zip
Fix feed push tag (#14064)
* Fix dashboard feed bug when push tag * Fix variable name * Fix delete tag Co-authored-by: 6543 <6543@obermui.de>
-rw-r--r--models/action.go5
-rw-r--r--templates/user/dashboard/feeds.tmpl6
2 files changed, 8 insertions, 3 deletions
diff --git a/models/action.go b/models/action.go
index e702a4263c..5546409241 100644
--- a/models/action.go
+++ b/models/action.go
@@ -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
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index b28c7c9a0b..ead8e76f31 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -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}}