diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json
index 029051584b..a707e564a7 100644
--- a/options/locale_next/locale_en-US.json
+++ b/options/locale_next/locale_en-US.json
@@ -180,5 +180,7 @@
"one": "%s active pull request",
"other": "%s active pull requests"
},
+ "teams.add_all_repos.modal.header": "Add all repositories",
+ "teams.remove_all_repos.modal.header": "Remove all repositories",
"meta.last_line": "Thank you for translating Forgejo! This line isn't seen by the users but it serves other purposes in the translation management. You can place a fun fact in the translation instead of translating it."
}
diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go
index 659bee469f..8e9d890a48 100644
--- a/routers/web/org/teams.go
+++ b/routers/web/org/teams.go
@@ -262,10 +262,6 @@ func TeamsRepoAction(ctx *context.Context) {
return
}
- if action == "addall" || action == "removeall" {
- ctx.JSONRedirect(ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName) + "/repositories")
- return
- }
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName) + "/repositories")
}
diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl
index f5d68ce416..ec0b9272d9 100644
--- a/templates/org/team/repositories.tmpl
+++ b/templates/org/team/repositories.tmpl
@@ -20,8 +20,8 @@
-
-
+
+
{{end}}
@@ -58,4 +58,31 @@
+
+
+
+
+
{{template "base/footer" .}}
diff --git a/tests/e2e/org-settings.test.e2e.ts b/tests/e2e/org-settings.test.e2e.ts
index b604ef0e8c..f74dcf139f 100644
--- a/tests/e2e/org-settings.test.e2e.ts
+++ b/tests/e2e/org-settings.test.e2e.ts
@@ -28,3 +28,36 @@ test('org team settings', async ({page}, workerInfo) => {
// we are validating the form here to include the part that could be hidden
await validate_form({page});
});
+
+test('org add and remove team repositories', async ({page}) => {
+ const response = await page.goto('/org/org3/teams/team1/repositories');
+ expect(response?.status()).toBe(200);
+
+ // As this is a shared state between multiple runs, always add repo3 to have some initial state.
+ await page.getByPlaceholder('Search repos…').fill('repo3');
+ await page.getByRole('button', {name: 'Add', exact: true}).click();
+ await expect(page.getByText('org3/repo3')).toBeVisible();
+
+ // Open remove all dialog.
+ await page.getByRole('button', {name: 'Remove all'}).click();
+ await expect(page.locator('#removeall-repos-modal')).toBeVisible();
+ await screenshot(page, page.locator('#removeall-repos-modal'));
+ // Remove all repositories.
+ await page.getByRole('button', {name: 'Yes'}).click();
+
+ // Check that all repositories are removed.
+ await expect(page.getByText('No repositories could be accessed by this team.')).toBeVisible();
+
+ // Open add all dialog.
+ await page.getByRole('button', {name: 'Add all'}).click();
+ await expect(page.locator('#addall-repos-modal')).toBeVisible();
+ await screenshot(page, page.locator('#addall-repos-modal'));
+ // Addd all repositories.
+ await page.getByRole('button', {name: 'Yes'}).click();
+
+ // Check that there are three repositories.
+ await expect(page.getByText('No repositories could be accessed by this team.')).toBeHidden();
+ await expect(page.getByText('org3/repo3')).toBeVisible();
+ await expect(page.getByText('org3/repo21')).toBeVisible();
+ await expect(page.getByText('org3/repo5')).toBeVisible();
+});