Skip to content
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

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

Merged
merged 7 commits into from
Jan 21, 2020

Conversation

bhalbright
Copy link
Contributor

Fix issue #9765. When adding or removing a dependency, a comment is generated on each issue. The comment when displayed in the UI assumes that the issue is in the same repository, but with cross repository dependencies, they are not. Fixed to show the full name of the issue and links to the correct issue.

…ncy, 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
@bhalbright
Copy link
Contributor Author

Before:
image

After:
image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 19, 2020
@codecov-io
Copy link

codecov-io commented Jan 19, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@547455b). Click here to learn what that means.
The diff coverage is 29.65%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #9863   +/-   ##
=========================================
  Coverage          ?   42.29%           
=========================================
  Files             ?      607           
  Lines             ?    79356           
  Branches          ?        0           
=========================================
  Hits              ?    33565           
  Misses            ?    41650           
  Partials          ?     4141
Impacted Files Coverage Δ
modules/auth/user_form.go 42.85% <ø> (ø)
models/repo.go 49.89% <ø> (ø)
modules/repository/repo.go 26.28% <0%> (ø)
cmd/admin.go 0% <0%> (ø)
routers/admin/admin.go 11.2% <0%> (ø)
services/wiki/wiki.go 57.08% <0%> (ø)
routers/repo/issue.go 37.91% <0%> (ø)
routers/api/v1/repo/issue_comment.go 56.33% <0%> (ø)
modules/repository/check.go 0% <0%> (ø)
routers/repo/issue_dependency.go 0% <0%> (ø)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 547455b...8409032. Read the comment docs.

…her the issue url, and added an if statement around the issue link display as a nil protection
@lunny lunny added this to the 1.12.0 milestone Jan 20, 2020
@lunny
Copy link
Member

lunny commented Jan 20, 2020

And I think maybe you should add if isCrossRef so that if it's not a cross repository, we should still keep the old text.

@lunny lunny mentioned this pull request Jan 20, 2020
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 20, 2020
{{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

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

as last commit

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 21, 2020
@zeripath
Copy link
Contributor

Make lg-tm work

@zeripath zeripath merged commit 2f7a747 into go-gitea:master Jan 21, 2020
@zeripath
Copy link
Contributor

Please send backport

@bhalbright bhalbright deleted the cross-repo-comment branch January 21, 2020 14:06
6543 pushed a commit to 6543-forks/gitea that referenced this pull request Jan 22, 2020
…o-gitea#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>
@6543
Copy link
Member

6543 commented Jan 22, 2020

created bakport for you @bhalbright (#9935)

lafriks pushed a commit that referenced this pull request Jan 22, 2020
…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>
@bhalbright
Copy link
Contributor Author

created bakport for you @bhalbright (#9935)

Thanks @6543 I wasn't going to have time this week, appreciate it.

@lunny lunny added the backport/done All backports for this PR have been created label Jan 22, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants