refactor: replace legacy delete-button with link-action (#38143)

Removes the legacy `delete-button` handler (`initGlobalDeleteButton`)
and migrates all remaining usages to `link-action` and `show-modal` /
`form-fetch-action`.

Two handlers are adjusted for the new request shape: webauthn key delete
reads `id` from the query, and account deletion returns `JSONError` on
validation failure.

A E2E test ist added to cover one of the use cases.

Suggested in
https://github.com/go-gitea/gitea/pull/38046#discussion_r3414936737.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
silverwind
2026-06-18 14:02:11 +02:00
committed by GitHub
parent 64f3796567
commit de83393487
29 changed files with 108 additions and 195 deletions
+18
View File
@@ -32,3 +32,21 @@ test('add team member search', async ({page, request}) => {
const result = page.locator('#search-user-box .results .result').first();
await expect(result).toContainText(userName);
});
test('delete team via confirm modal', async ({page, request}) => {
const orgName = `e2e-del-team-${randomString(8)}`;
const teamName = `team-${randomString(8)}`;
await Promise.all([
(async () => {
await apiCreateOrg(request, orgName);
await apiCreateTeam(request, orgName, teamName);
})(),
login(page),
]);
await page.goto(`/org/${orgName}/teams/${teamName}/edit`);
await page.getByRole('button', {name: 'Delete Team'}).click();
await page.getByRole('button', {name: 'Yes'}).click();
await expect(page).toHaveURL(new RegExp(`/org/${orgName}/teams$`));
await expect(page.getByText('The team has been deleted.')).toBeVisible();
});