[MODERATION] Purge issues on user deletion

- Forgejo has the option to delete users, in which all data except
issues and comments are removed, this makes sense in some cases where
users need to be removed cleanly but without removing their existing bug
reports or comments to an discussion. In the case of spammers, admins
have the option to enable purging, where comments are removed.
- Add issues to the list of things to be removed if purge is checked.
- No unit testing, as this gigantic function doesn't have one to begin
with.
- Add integration test.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1268

(cherry picked from commit 3ed381c758)
(cherry picked from commit 44d00650ce)
This commit is contained in:
Gusted 2023-08-26 23:10:42 +02:00 committed by Earl Warren
parent 67f37c8346
commit 7f4da82779
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
11 changed files with 67 additions and 20 deletions

View file

@ -75,9 +75,10 @@ func TestAdminDeleteUser(t *testing.T) {
csrf := GetCSRF(t, session, "/admin/users/8/edit")
req := NewRequestWithValues(t, "POST", "/admin/users/8/delete", map[string]string{
"_csrf": csrf,
"purge": "true",
})
session.MakeRequest(t, req, http.StatusSeeOther)
assertUserDeleted(t, 8)
assertUserDeleted(t, 8, true)
unittest.CheckConsistencyFor(t, &user_model.User{})
}