forgejo/templates/admin
floss4good d5fa12ded1
Some checks failed
/ release (push) Has been cancelled
testing-integration / test-unit (push) Has been cancelled
testing-integration / test-sqlite (push) Has been cancelled
testing-integration / test-mariadb (v10.6) (push) Has been cancelled
testing-integration / test-mariadb (v11.8) (push) Has been cancelled
testing / backend-checks (push) Has been cancelled
testing / frontend-checks (push) Has been cancelled
testing / test-unit (push) Has been cancelled
testing / test-e2e (push) Has been cancelled
testing / test-remote-cacher (redis) (push) Has been cancelled
testing / test-remote-cacher (valkey) (push) Has been cancelled
testing / test-remote-cacher (garnet) (push) Has been cancelled
testing / test-remote-cacher (redict) (push) Has been cancelled
testing / test-mysql (push) Has been cancelled
testing / test-pgsql (push) Has been cancelled
testing / test-sqlite (push) Has been cancelled
testing / security-check (push) Has been cancelled
feat: add admin moderation actions for abuse reports and for reported abusive content (#8716)
- Implementation of milestone 6. from **Task F. Moderation features: Reporting** (part of [amendment of the workplan](https://codeberg.org/forgejo/sustainability/src/branch/main/2022-12-01-nlnet/2025-02-07-extended-workplan.md#task-f-moderation-features-reporting) for NLnet 2022-12-035):
  `6. Forgejo admins can perform common actions on the listed reports (content deletion, locking of user account)`

---

Follow-up of !7905 (and !6977)

---

This adds some action buttons within the _Moderation reports_ section (/admin/moderation/reports) within the _Site administration_ page, so that administrators can:
- mark a report as Handled or as Ignored (without performing any action on the reported content);
- mark a user account as suspended (set `prohibit_login` = true);
- delete (and purge) a user / organization and mark the linked reports as Handled;
- delete a repository and mark the linked reports as Handled;
- delete an issue / pull request and mark the linked reports as Handled;
- delete a comment and mark the linked reports as Handled;

The buttons were added on the sight side of each report from the overview, below the existing counter (that show how many times the content was reported and opens the details page). Only the buttons for updating the status of the report are directly visible - as `✓` and `✗` icons with some tooltips - while the content actions are hidden under a `⋯` dropdown.
The implementation was done using HTMX so that the page is not refreshed after each action.

Some discussions regarding the UI/UX started with https://codeberg.org/forgejo/design/issues/30#issuecomment-5958634

### Manual testing
- First make sure that moderation in enabled ([moderation] ENABLED config is set as true within app.ini).
- Report multiple users, organizations, repositories, issues, pull requests and comments.
- Go to _Moderation reports_ overview section section and make sure the buttons are visible;
  - The `✓` and `✗` should be available for each shown report;
  - The horizontal dropdown menu (`⋯`) should not be visible for reports linked to already deleted content.
- The actions available within the dropdown menu should correspond to the reported content type (e.g. 'Suspend account' and 'Delete account' for users/organizations, 'Delete repository' for repositories, etc.).
- When an action is successful a flash message should be displayed above the overview.
- Warnings should be displayed (as flash messages) when trying to suspend or delete your account (in case someone reported you) or an organization.
- An info (flash message) should be displayed when trying to suspend a user that is already suspended.
- Mark a report as Handled / Ignored and observe that a success flash message confirms the action and the report is removed from the list without reloading the page;
  - Refresh the page to make sure the report will not be loaded again (also check in the DB that the status was updated and the resolved timestamp is correctly set).
- Suspend a user account and make sure the report remains in the list (it is not resolved);
  - Make sure the above user gets the 'Suspended account' notice after login.
- Delete a user account and observe that a success flash message confirms the action and the report is removed from the list without reloading the page;
  - Make sure that all owned organizations and repositories as well as all the issues, PRs and comments posted in other repositories were deleted;
  - Make sure the linked abuse reports are marked as Handled (and resolved timestamp is set).
- Delete an organization and make sure that owned repositories were also deleted.
- Similarly, delete a repository / issue / PR / comment and check that the contents are not available any more and the linked reports are resolved.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8716
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: floss4good <floss4good@disroot.org>
Co-committed-by: floss4good <floss4good@disroot.org>
2025-12-03 20:07:32 +01:00
..
applications Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00
auth feat: allow sync quota groups with oauth2 auth source (#8554) 2025-12-01 14:12:00 +01:00
emails feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
moderation feat: add admin moderation actions for abuse reports and for reported abusive content (#8716) 2025-12-03 20:07:32 +01:00
org fix(i18n): fix several usages of i18n (#7422) 2025-04-02 14:50:02 +00:00
packages feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
repo fix: admin repo page error on NumIssues (#9983) 2025-11-05 18:16:35 +01:00
runners Move secrets and runners settings to actions settings (#24200) 2023-04-27 20:08:47 -04:00
user feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
actions.tmpl Added instance-level variables (#28115) 2023-12-25 07:28:59 +00:00
config.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
config_settings.tmpl Remove fomantic checkbox module (#30162) 2024-04-07 11:05:37 +02:00
cron.tmpl feat(ui): improve admin dashboard cron list (#10270) 2025-12-01 15:19:36 +01:00
dashboard.tmpl feat(ui): improve admin dashboard cron list (#10270) 2025-12-01 15:19:36 +01:00
hook_new.tmpl Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00
hooks.tmpl Change to vertical navbar layout for secondary navbar for repo/user/admin settings (#24246) 2023-04-23 18:21:21 +08:00
layout_footer.tmpl Change to vertical navbar layout for secondary navbar for repo/user/admin settings (#24246) 2023-04-23 18:21:21 +08:00
layout_head.tmpl [UI] Fix admin layout 2024-07-30 23:35:22 +02:00
navbar.tmpl feat: Admin interface for abuse reports (#7905) 2025-07-23 00:20:15 +02:00
notice.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
queue.tmpl Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00
queue_manage.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
self_check.tmpl Add cache test for admins (#31265) 2024-06-23 11:27:03 +02:00
stacktrace-row.tmpl feat: require data-modal-id for delete buttons (#8711) 2025-08-08 01:53:23 +02:00
stacktrace.tmpl feat: require data-modal-id for delete buttons (#8711) 2025-08-08 01:53:23 +02:00
stats.tmpl [REFACTOR] Simplify converting struct to map in admin stats 2024-02-22 22:25:19 +01:00
system_status.tmpl Auto-update the system status in admin dashboard (#29163) 2024-02-17 23:24:31 +01:00