Skip to content

Fixed repo link in generated comment for cross repository dependency #9863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 21, 2020
5 changes: 5 additions & 0 deletions models/issue_comment_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ func (comments CommentList) loadDependentIssues(e Engine) error {
for _, comment := range comments {
if comment.DependentIssue == nil {
comment.DependentIssue = issues[comment.DependentIssueID]
if comment.DependentIssue != nil {
if err := comment.DependentIssue.loadRepo(e); err != nil {
return err
}
}
}
}
return nil
Expand Down
20 changes: 12 additions & 8 deletions templates/repo/issue/view_content/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,12 @@
<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}}">{{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}</a></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If current repo != dependentissue.repo ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Only show repo name if needed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @6543 and @lunny I changed as suggested:

image

</div>
{{end}}
</div>
{{else if eq .Type 20}}
<div class="event" id="{{.HashTag}}">
Expand All @@ -291,10 +293,12 @@
<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}}">{{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}</a></span>
</div>
{{end}}
</div>
{{else if eq .Type 22}}
<div class="event" id="{{.HashTag}}">
Expand Down