aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-10-02 12:37:16 +0800
committerGitHub <noreply@github.com>2024-10-02 04:37:16 +0000
commita989404e23f736e7ce1c71e7105506e3bc6cdd76 (patch)
tree10e3c797b382de65fde50a076a61f020d4fb5389 /web_src
parent3a4a1bffbebd8a6f024a7fc4849cebbd7f0274d4 (diff)
downloadgitea-a989404e23f736e7ce1c71e7105506e3bc6cdd76.tar.gz
gitea-a989404e23f736e7ce1c71e7105506e3bc6cdd76.zip
Fix javascript error when an anonymous user visiting migration page (#32144)
This PR fixes javascript errors when an anonymous user visits the migration page. It also makes task view checking more restrictive. The router moved from `/user/task/{id}/status` to `/username/reponame/-/migrate/status` because it's a migrate status. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/repo-migrate.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/web_src/js/features/repo-migrate.ts b/web_src/js/features/repo-migrate.ts
index dc36177940..b75289feec 100644
--- a/web_src/js/features/repo-migrate.ts
+++ b/web_src/js/features/repo-migrate.ts
@@ -1,19 +1,17 @@
import {hideElem, showElem} from '../utils/dom.ts';
import {GET, POST} from '../modules/fetch.ts';
-const {appSubUrl} = window.config;
-
export function initRepoMigrationStatusChecker() {
const repoMigrating = document.querySelector('#repo_migrating');
if (!repoMigrating) return;
- document.querySelector('#repo_migrating_retry').addEventListener('click', doMigrationRetry);
+ document.querySelector('#repo_migrating_retry')?.addEventListener('click', doMigrationRetry);
- const task = repoMigrating.getAttribute('data-migrating-task-id');
+ const repoLink = repoMigrating.getAttribute('data-migrating-repo-link');
// returns true if the refresh still needs to be called after a while
const refresh = async () => {
- const res = await GET(`${appSubUrl}/user/task/${task}`);
+ const res = await GET(`${repoLink}/-/migrate/status`);
if (res.status !== 200) return true; // continue to refresh if network error occurs
const data = await res.json();