summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <24977596+6543@users.noreply.github.com>2019-11-02 23:47:25 +0100
committertechknowlogick <techknowlogick@gitea.io>2019-11-02 18:47:25 -0400
commit76185edd7668165429f008156251d1bb84e61973 (patch)
tree8e5be320f334d14f77cb68ccd75039b2a91c4bc7
parent729708e878f543cbe1aef3908cfde67bf77a07eb (diff)
downloadgitea-76185edd7668165429f008156251d1bb84e61973.tar.gz
gitea-76185edd7668165429f008156251d1bb84e61973.zip
FIX download diff/patch from commit (#8792)
* send fix * restart CI * us Commit only when available * CI.redo() * more specific if statement Co-Authored-By: mrsdizzie <info@mrsdizzie.com>
-rw-r--r--templates/repo/diff/options_dropdown.tmpl9
1 files changed, 7 insertions, 2 deletions
diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl
index 9fca069f0a..4bc6a3b994 100644
--- a/templates/repo/diff/options_dropdown.tmpl
+++ b/templates/repo/diff/options_dropdown.tmpl
@@ -3,7 +3,12 @@
<i class="dropdown icon"></i>
<div class="menu">
<a class="item tiny basic toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
- <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.i18n.Tr "repo.diff.download_patch"}}</a>
- <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.i18n.Tr "repo.diff.download_diff"}}</a>
+ {{if .Issue.Index}}
+ <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.i18n.Tr "repo.diff.download_patch"}}</a>
+ <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.i18n.Tr "repo.diff.download_diff"}}</a>
+ {{else if .Commit.ID.String}}
+ <a class="item" href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}.patch" download="{{ShortSha .Commit.ID.String}}.patch">{{.i18n.Tr "repo.diff.download_patch"}}</a>
+ <a class="item" href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}.diff" download="{{ShortSha .Commit.ID.String}}.diff">{{.i18n.Tr "repo.diff.download_diff"}}</a>
+ {{end}}
</div>
</div>