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

Improved ref comment link when origin is body/title #19741

Merged
merged 3 commits into from
May 18, 2022

Conversation

Eekle
Copy link
Contributor

@Eekle Eekle commented May 18, 2022

Comments with references use RefCommentHTMLURL() to fetch the URL location to link to.

However for references originating in body text or titles, this falls back to a value of "".

This means that when a reference comes from a body/title, the link just reloads the current page, which is weird.

image

This PR changes the fallback behaviour to return the URL of the originating issue/PR. This way if the body text of pulls/X links to an issue, then the cross ref comment will link to 'pulls/X'.

image

There are no other references to RefCommentHTMLURL() in the codebase so I don't think this has any risk.

@delvh delvh added this to the 1.17.0 milestone May 18, 2022
models/issue_xref.go Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 18, 2022
Co-authored-by: delvh <dev.lh@web.de>
@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 May 18, 2022
@6543 6543 merged commit 260a28d into go-gitea:main May 18, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 19, 2022
* giteaofficial/main:
  Update base.go (go-gitea#19739)
  [doctor] do not update User Stars numbers unless --fix (go-gitea#19750)
  Fix incorrect translation key (go-gitea#19744)
  Improved ref comment link when origin is body/title (go-gitea#19741)
  [doctor] explain what enable-push-options does (go-gitea#19740)
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 24, 2022
* Makes comments in body text/title return the base page URL instead of "" in RefCommentHTMLURL()

* Add comment explaining branch

Co-authored-by: delvh <dev.lh@web.de>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
@delvh delvh added topic/ui-interaction Change the process how users use Gitea instead of the visual appearance and removed kind/usability labels Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants