Remove branch URL before IssueRefURL #15968

Merged
fnetX merged 1 commits from issue-branch-ref into main 2021-05-25 20:02:37 +00:00
fnetX commented 2021-05-24 15:37:46 +00:00 (Migrated from github.com)

My attempt to fix #15967 (duplicate Owner/Branch in URL when linking to a branch from an issue).
It appears to me as if IssueRefURLs already contain the full valid URL by now and thus prepending the Owner and Branch leads to duplication.

My attempt to fix #15967 (duplicate Owner/Branch in URL when linking to a branch from an issue). It appears to me as if `IssueRefURLs` already contain the full valid URL by now and thus prepending the Owner and Branch leads to duplication.
noerw (Migrated from github.com) requested changes 2021-05-24 16:04:53 +00:00
noerw (Migrated from github.com) left a comment

Thanks! One nit, see code comment.
Ffor reference; the repoLink is prepended to the URLs here already
cc7e1b84a7/services/issue/issue.go (L167)

Thanks! One nit, see code comment. Ffor reference; the `repoLink` is prepended to the URLs here already https://github.com/go-gitea/gitea/blob/cc7e1b84a7d32497e12e020e0fb0fe8649da04de/services/issue/issue.go#L167
noerw (Migrated from github.com) commented 2021-05-24 16:04:08 +00:00

Both cases have the same result; simplify as

						<a class="ref" href="{{index $.IssueRefURLs .ID}}">
Both cases have the same result; simplify as ```suggestion <a class="ref" href="{{index $.IssueRefURLs .ID}}"> ```
fnetX (Migrated from github.com) reviewed 2021-05-24 16:19:15 +00:00
fnetX (Migrated from github.com) commented 2021-05-24 16:19:15 +00:00

Sure, didn't have a close look since this logic appeared unrelated to my PR 😂

Sure, didn't have a close look since this logic appeared unrelated to my PR :joy:
noerw (Migrated from github.com) reviewed 2021-05-24 17:12:23 +00:00
noerw (Migrated from github.com) commented 2021-05-24 17:12:23 +00:00
 						<a class="ref" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{index $.IssueRefURLs .ID}}"{{end}}> 
```suggestion <a class="ref" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{index $.IssueRefURLs .ID}}"{{end}}> ```
fnetX (Migrated from github.com) reviewed 2021-05-24 17:41:24 +00:00
fnetX (Migrated from github.com) commented 2021-05-24 17:41:24 +00:00

Just to confirm this a last time: .RepoLink holds the information whether {index $.IssueRefURLs .ID}} holds the full URL or not? That makes sense then.

Just to confirm this a last time: `.RepoLink` holds the information whether `{index $.IssueRefURLs .ID}}` holds the full URL or not? That makes sense then.
noerw (Migrated from github.com) reviewed 2021-05-24 17:49:00 +00:00
noerw (Migrated from github.com) commented 2021-05-24 17:49:00 +00:00

Right, that's my understanding from a couple of tests (it actually holds absolute URL to the repo, but this is only set on the <owner>/<repo>/issues page)

Right, that's my understanding from a couple of tests (it actually holds absolute URL to the repo, but this is only set on the `<owner>/<repo>/issues` page)
KN4CK3R (Migrated from github.com) approved these changes 2021-05-25 10:34:38 +00:00
noerw (Migrated from github.com) approved these changes 2021-05-25 12:44:30 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#15968
No description provided.