mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 09:02:42 +01:00
Fixed repo link in generated comment for cross repository dependency (#9863)
* 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: Antoine GIRARD <sapk@users.noreply.github.com>
This commit is contained in:
parent
5cf241b312
commit
2f7a747e4f
2 changed files with 33 additions and 8 deletions
|
@ -376,6 +376,11 @@ func (comments CommentList) loadDependentIssues(e Engine) error {
|
||||||
for _, comment := range comments {
|
for _, comment := range comments {
|
||||||
if comment.DependentIssue == nil {
|
if comment.DependentIssue == nil {
|
||||||
comment.DependentIssue = issues[comment.DependentIssueID]
|
comment.DependentIssue = issues[comment.DependentIssueID]
|
||||||
|
if comment.DependentIssue != nil {
|
||||||
|
if err := comment.DependentIssue.loadRepo(e); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -277,10 +277,20 @@
|
||||||
<span class="text grey">
|
<span class="text grey">
|
||||||
{{$.i18n.Tr "repo.issues.dependency.added_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
{{$.i18n.Tr "repo.issues.dependency.added_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
||||||
</span>
|
</span>
|
||||||
|
{{if .DependentIssue}}
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="octicon octicon-plus"></span>
|
<span class="octicon octicon-plus"></span>
|
||||||
<span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></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>
|
</div>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{else if eq .Type 20}}
|
{{else if eq .Type 20}}
|
||||||
<div class="event" id="{{.HashTag}}">
|
<div class="event" id="{{.HashTag}}">
|
||||||
|
@ -291,10 +301,20 @@
|
||||||
<span class="text grey">
|
<span class="text grey">
|
||||||
{{$.i18n.Tr "repo.issues.dependency.removed_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
{{$.i18n.Tr "repo.issues.dependency.removed_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
||||||
</span>
|
</span>
|
||||||
|
{{if .DependentIssue}}
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="text grey octicon octicon-trashcan"></span>
|
<span class="text grey octicon octicon-trashcan"></span>
|
||||||
<span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></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>
|
</div>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{else if eq .Type 22}}
|
{{else if eq .Type 22}}
|
||||||
<div class="event" id="{{.HashTag}}">
|
<div class="event" id="{{.HashTag}}">
|
||||||
|
|
Loading…
Reference in a new issue