Skip to content

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

Merged
6543 merged 3 commits into
go-gitea:mainfrom
Eekle:comment_url
May 18, 2022
Merged

Improved ref comment link when origin is body/title#19741
6543 merged 3 commits into
go-gitea:mainfrom
Eekle:comment_url

Conversation

@Eekle
Copy link
Copy Markdown
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
Comment thread models/issue_xref.go
@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.

4 participants