Modified - [admin] [badges] [orgs] [delete] Added direct delete actions in the admin badges and organizations tables.
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-container (push) Has been cancelled

- 1 - Mod: `/-/admin/badges` now shows a delete button in each row that opens the badge delete modal directly from the table.
- 2 - Mod: `/-/admin/orgs` now shows a delete button in each row that opens an organization delete modal directly from the table.
- 3 - Mod: the new table actions reuse the original delete modal layouts already used in badge edit and organization settings, and deleting an organization from `/-/admin/orgs` now returns to the admin organizations list instead of `/`.
This commit is contained in:
2026-05-24 06:03:05 +03:00
parent 6ea9c8660f
commit 406e6d0697
6 changed files with 99 additions and 2 deletions
+5
View File
@@ -888,3 +888,8 @@ History search guidance:
- 2 - Mod: `Retry` and `Delete This Repository` stay hidden until the migration task is fully stopped.
- 3 - Fix: canceled migrations now persist as `stopped` and no longer show the raw `clone error: context canceled ...` message.
- 4 - Fix: added an opt-in Windows process-tree kill for migration clone commands via `taskkill /T /F`, because Git helper processes could remain alive after `Cancel`, keep writing `tmp_pack_*`, and block cleanup or retry.
185 - [2026-05-24 04:23:19] - v1.27.0-dev-196-g6ea9c8660f - Type: Modified - [admin] [badges] [orgs] [delete] Added direct delete actions in the admin badges and organizations tables.
- 1 - Mod: `/-/admin/badges` now shows a delete button in each row that opens the badge delete modal directly from the table.
- 2 - Mod: `/-/admin/orgs` now shows a delete button in each row that opens an organization delete modal directly from the table.
- 3 - Mod: the new table actions reuse the original delete modal layouts already used in badge edit and organization settings, and deleting an organization from `/-/admin/orgs` now returns to the admin organizations list instead of `/`.
+1
View File
@@ -22,6 +22,7 @@ const (
func Organizations(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.organizations")
ctx.Data["PageIsAdminOrganizations"] = true
ctx.Data["CurrentRequestURI"] = ctx.Req.RequestURI // edit/add - by petru @ codex
if ctx.FormString("sort") == "" {
ctx.SetFormString("sort", UserSearchDefaultAdminSort)
+19 -1
View File
@@ -14,6 +14,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/httplib"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/optional"
repo_module "code.gitea.io/gitea/modules/repository"
@@ -39,6 +40,15 @@ const (
tplSettingsLabels templates.TplName = "org/settings/labels"
)
// start edit/add - by petru @ codex
func setOrgSettingsRedirectTo(ctx *context.Context) {
if redirectTo := ctx.FormString("redirect_to"); redirectTo != "" && httplib.IsRelativeURL(redirectTo) {
ctx.Data["RedirectTo"] = redirectTo
}
}
// end edit/add - by petru @ codex
// Settings render the main settings page
func Settings(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("org.settings")
@@ -47,6 +57,7 @@ func Settings(ctx *context.Context) {
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
ctx.Data["RepoAdminChangeTeamAccess"] = ctx.Org.Organization.RepoAdminChangeTeamAccess
ctx.Data["ContextUser"] = ctx.ContextUser
setOrgSettingsRedirectTo(ctx) // edit/add - by petru @ codex
if _, err := shared_user.RenderUserOrgHeader(ctx); err != nil {
ctx.ServerError("RenderUserOrgHeader", err)
@@ -63,6 +74,7 @@ func SettingsPost(ctx *context.Context) {
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsOptions"] = true
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
setOrgSettingsRedirectTo(ctx) // edit/add - by petru @ codex
if ctx.HasError() {
ctx.HTML(http.StatusOK, tplSettingsOptions)
@@ -143,7 +155,13 @@ func SettingsDeleteOrgPost(ctx *context.Context) {
}
ctx.Flash.Success(ctx.Tr("org.settings.delete_successful", ctx.Org.Organization.Name))
ctx.JSONRedirect(setting.AppSubURL + "/")
// start edit/add - by petru @ codex
redirectTo := setting.AppSubURL + "/"
if formRedirectTo := ctx.FormString("redirect_to"); formRedirectTo != "" && httplib.IsRelativeURL(formRedirectTo) {
redirectTo = formRedirectTo
}
ctx.JSONRedirect(redirectTo)
// end edit/add - by petru @ codex
}
// Webhooks render webhook list page
+21
View File
@@ -51,10 +51,16 @@
</td>
<td class="gt-ellipsis tw-max-w-48">{{.Description}}</td>
<td>
{{/* start edit/add - by petru @ codex */}}
<div class="tw-flex tw-gap-2">
<a href="{{$.Link}}/slug/{{.Slug | PathEscape}}" data-tooltip-content="{{ctx.Locale.Tr "admin.badges.details"}}">{{svg "octicon-star"}}</a>
<a href="{{$.Link}}/slug/{{.Slug | PathEscape}}/edit" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a>
<a class="tw-text-red show-modal" href data-modal="#admin-badge-delete-modal"
data-modal-form.action="{{$.Link}}/slug/{{.Slug | PathEscape}}/delete"
data-tooltip-content="{{ctx.Locale.Tr "admin.badges.delete_badge"}}"
>{{svg "octicon-trash"}}</a> <!-- edit/add - by petru @ codex -->
</div>
{{/* end edit/add - by petru @ codex */}}
</td>
</tr>
{{end}}
@@ -64,4 +70,19 @@
{{template "base/paginate" .}}
</div>
{{/* start edit/add - by petru @ codex */}}
<div class="ui g-modal-confirm modal" id="admin-badge-delete-modal">
<div class="header">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "admin.badges.delete_badge"}}
</div>
<form class="ui form" method="post">
<div class="content">
<p>{{ctx.Locale.Tr "admin.badges.delete_badge_desc"}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</form>
</div> <!-- edit/add - by petru @ codex -->
{{/* end edit/add - by petru @ codex */}}
{{template "admin/layout_footer" .}}
+48 -1
View File
@@ -77,7 +77,18 @@
<td>{{.NumMembers}}</td>
<td>{{.NumRepos}}</td>
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td>
<td>
{{/* start edit/add - by petru @ codex */}}
<div class="tw-flex tw-gap-2">
<a href="{{.OrganisationLink}}/settings?redirect_to={{$.CurrentRequestURI | QueryEscape}}" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a> <!-- edit/add - by petru @ codex -->
<a class="tw-text-red show-modal" href data-modal="#admin-org-delete-modal"
data-modal-form.action="{{.OrganisationLink}}/settings/delete"
data-modal-org-name="{{.Name}}" data-modal-org-name-notice-2="{{.Name}}" data-modal-org-name-notice-3="{{.Name}}" data-modal-org-name-notice-4="{{.Name}}" data-modal-confirm-org-name.value=""
data-tooltip-content="{{ctx.Locale.Tr "org.settings.delete_account"}}"
>{{svg "octicon-trash"}}</a> <!-- edit/add - by petru @ codex -->
</div>
{{/* end edit/add - by petru @ codex */}}
</td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
@@ -88,4 +99,40 @@
{{template "base/paginate" .}}
</div>
{{/* start edit/add - by petru @ codex */}}
<div class="ui small modal" id="admin-org-delete-modal">
<div class="header">
{{ctx.Locale.Tr "org.settings.delete_account"}}
</div>
<div class="content">
<div class="ui warning message">
<ul>
<li>{{ctx.Locale.Tr "org.settings.delete_notices_1"}}</li>
<li>{{ctx.Locale.Tr "org.settings.delete_notices_2" `<span id="org-name-notice-2"></span>`}}</li>
<li>{{ctx.Locale.Tr "org.settings.delete_notices_3" `<span id="org-name-notice-3"></span>`}}</li>
<li>{{ctx.Locale.Tr "org.settings.delete_notices_4" `<span id="org-name-notice-4"></span>`}}</li>
</ul>
</div>
<form class="ui form form-fetch-action" method="post">
<input type="hidden" name="redirect_to" value="{{AppSubUrl}}/-/admin/orgs"> <!-- edit/add - by petru @ codex -->
<div class="field">
<label>
{{ctx.Locale.Tr "org.settings.name_confirm"}}
<span class="tw-text-red" id="org-name"></span> <!-- edit/add - by petru @ codex -->
</label>
</div>
<div class="required field">
<label>{{ctx.Locale.Tr "org.org_name_holder"}}</label>
<input name="org_name" id="confirm-org-name" required> <!-- edit/add - by petru @ codex -->
</div>
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "org.settings.delete_account"}}</button>
</div>
</form>
</div>
</div> <!-- edit/add - by petru @ codex -->
{{/* end edit/add - by petru @ codex */}}
{{template "admin/layout_footer" .}}
@@ -122,6 +122,11 @@
</ul>
</div>
<form class="ui form form-fetch-action" action="{{.Link}}/delete" method="post">
{{/* start edit/add - by petru @ codex */}}
{{if .RedirectTo}}
<input type="hidden" name="redirect_to" value="{{.RedirectTo}}">
{{end}}
{{/* end edit/add - by petru @ codex */}}
<div class="field">
<label>
{{ctx.Locale.Tr "org.settings.name_confirm"}}