Fix incorrect subpath in links (#29535) (#29541)

Backport #29535 by wxiaoguang

* `$referenceUrl`: it is constructed by "Issue.Link", which already has
the "AppSubURL"
* `window.location.href`: AppSubURL could be empty string, so it needs
the trailing slash

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 401cc394d52c6126d3cbca1e1367c4e4da5110f9)
This commit is contained in:
Giteabot 2024-03-02 20:26:54 +08:00 committed by Earl Warren
parent e6441a18d2
commit 22419d9f8d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 4 additions and 4 deletions

View file

@ -33,7 +33,7 @@
<div class="comment-header-right actions gt-df gt-ac">
{{if .Invalidated}}
{{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}}
<a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
<a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
</a>
{{end}}

View file

@ -14,7 +14,7 @@
We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above).
The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl
-->
<a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
<a href="{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
</a>
{{end}}

View file

@ -112,7 +112,7 @@ export function initNotificationCount() {
type: 'close',
});
worker.port.close();
window.location.href = appSubUrl;
window.location.href = `${appSubUrl}/`;
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',

View file

@ -74,7 +74,7 @@ export function initStopwatch() {
type: 'close',
});
worker.port.close();
window.location.href = appSubUrl;
window.location.href = `${appSubUrl}/`;
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',