refactor: clean up git migration forms (#39672)

Only extracted shared code, removed unnecessary code, and use
form-fetch-action to replace RenderWithErrDeprecated, slightly
refactored JS to use data-global-init

Nothing else is changed, although there are still many problems.

Written by AI

Diff with hiding spaces:
https://github.com/go-gitea/gitea/pull/39672/changes?w=1
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-10-08 10:36:08 +02:00
1 parent 89ec271d9c
commit cc623c5f2f
18 files changed
+274 -724

No files matched your search

+2 -2
View File
@@ -94,9 +94,9 @@ func TestMigrateGiteaForm(t *testing.T) {
"description": "",
"uid": strconv.FormatInt(repoOwner.ID, 10),
})
resp = session.MakeRequest(t, req, http.StatusSeeOther)
resp = session.MakeRequest(t, req, http.StatusOK)
// Step 5: a redirection displays the migrated repository
loc := resp.Header().Get("Location")
loc := *test.ParseJSONRedirect(resp.Body.Bytes()).Redirect
assert.Equal(t, fmt.Sprintf("/%s/%s", ownerName, migratedRepoName), loc)
// Step 6: check the repo was created
unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: migratedRepoName})