diff options
author | 6543 <6543@obermui.de> | 2020-01-22 11:54:40 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2020-01-22 12:54:40 +0200 |
commit | 128cc34344104bfe32427a7ecc8422cd7a2918d6 (patch) | |
tree | 4a535e68ca3261a018501a7ba8fb32d9c7315564 /templates/repo | |
parent | f82a8054787e3a334619b918b4e416b3d0bea47a (diff) | |
download | gitea-128cc34344104bfe32427a7ecc8422cd7a2918d6.tar.gz gitea-128cc34344104bfe32427a7ecc8422cd7a2918d6.zip |
Fixed repo link in generated comment for cross repository dependency (#9863) (#9935)
* fixed link to issue in issue comments after adding/removing a dependency, before links assumed the issue was in the same repository. also changed the format of the displayed issue since the issue will not necessarily be in the same repo
* based on pr comments, changed to use HTMLURL instead of piecing together the issue url, and added an if statement around the issue link display as a nil protection
* only showing repo name in dependency comment if the issue is from another repo
Co-authored-by: Brad Albright <32200834+bhalbright@users.noreply.github.com>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Diffstat (limited to 'templates/repo')
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 658494ac30..40db434dec 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -277,10 +277,20 @@ <span class="text grey"> {{$.i18n.Tr "repo.issues.dependency.added_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}} </span> - <div class="detail"> - <span class="octicon octicon-plus"></span> - <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span> - </div> + {{if .DependentIssue}} + <div class="detail"> + <span class="octicon octicon-plus"></span> + <span class="text grey"> + <a href="{{.DependentIssue.HTMLURL}}"> + {{if eq .DependentIssue.RepoID .Issue.RepoID}} + #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else}} + {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{end}} + </a> + </span> + </div> + {{end}} </div> {{else if eq .Type 20}} <div class="event" id="{{.HashTag}}"> @@ -291,10 +301,20 @@ <span class="text grey"> {{$.i18n.Tr "repo.issues.dependency.removed_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}} </span> - <div class="detail"> - <span class="text grey octicon octicon-trashcan"></span> - <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span> - </div> + {{if .DependentIssue}} + <div class="detail"> + <span class="text grey octicon octicon-trashcan"></span> + <span class="text grey"> + <a href="{{.DependentIssue.HTMLURL}}"> + {{if eq .DependentIssue.RepoID .Issue.RepoID}} + #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else}} + {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{end}} + </a> + </span> + </div> + {{end}} </div> {{else if eq .Type 22}} <div class="event" id="{{.HashTag}}"> |