mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-19 08:51:10 +00:00
fix: use correct format for pull request references (#8890)
Use `!` instead of `#` for references in the sidebar of pull requests. This is useful when the repository uses a external issue tracker to avoid it being redirected to the external issue tracker. Resolves forgejo/forgejo#8713 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8890 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: jank1619 <jank1619@noreply.codeberg.org> Co-committed-by: jank1619 <jank1619@noreply.codeberg.org>
This commit is contained in:
parent
b0c453902b
commit
011e876f5c
2 changed files with 22 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
<div class="ui reference">
|
||||
{{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}}
|
||||
{{$issueReferenceLink := ""}}
|
||||
{{if .Issue.IsPull}}
|
||||
{{$issueReferenceLink = printf "%s!%d" .Issue.Repo.FullName .Issue.Index}}
|
||||
{{else}}
|
||||
{{$issueReferenceLink = printf "%s#%d" .Issue.Repo.FullName .Issue.Index}}
|
||||
{{end}}
|
||||
<span class="text">
|
||||
<strong>
|
||||
{{ctx.Locale.Tr "discussion.sidebar.reference"}}
|
||||
|
|
|
@ -349,3 +349,19 @@ test.describe('Dependency dropdown', () => {
|
|||
await expect(depsBlock).toContainText('No dependencies set');
|
||||
});
|
||||
});
|
||||
|
||||
test('Issue: Reference', async ({page}) => {
|
||||
let response = await page.goto('/user2/repo1/pulls/5');
|
||||
expect(response?.status()).toBe(200);
|
||||
|
||||
await expect(page.locator('.ui.reference .truncate')).toContainText(
|
||||
'user2/repo1!5',
|
||||
);
|
||||
|
||||
response = await page.goto('/user2/repo1/issues/1');
|
||||
expect(response?.status()).toBe(200);
|
||||
|
||||
await expect(page.locator('.ui.reference .truncate')).toContainText(
|
||||
'user2/repo1#1',
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue