From 956aaf21a9f7df2ac9e78daffc28fdd569c09424 Mon Sep 17 00:00:00 2001 From: EchoEkhi Date: Sun, 18 Jan 2026 14:57:17 +0000 Subject: [PATCH 1/2] AO3-7273 Make spambans remove profile texts, pseud descriptions and icons --- .../admin/admin_users_controller.rb | 15 ++++++++++ .../admins/users/admin_abuse_users.feature | 15 +++++++++- features/step_definitions/pseud_steps.rb | 28 +++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/admin_users_controller.rb b/app/controllers/admin/admin_users_controller.rb index 69cb925e87e..9fe32fa8d90 100644 --- a/app/controllers/admin/admin_users_controller.rb +++ b/app/controllers/admin/admin_users_controller.rb @@ -184,6 +184,21 @@ def destroy_user_creations comment.destroy_or_mark_deleted # comments with replies cannot be destroyed, mark deleted instead end + @user.profile.title = nil + @user.profile.about_me = nil + + @user.profile.save(validate: false) + + + @user.pseuds.each do |pseud| + pseud.description = nil + pseud.icon_alt_text = nil + pseud.icon_comment_text = nil + pseud.icon.purge + + pseud.save(validate: false) + end + flash[:notice] = t(".success", login: @user.login) redirect_to(admin_users_path) end diff --git a/features/admins/users/admin_abuse_users.feature b/features/admins/users/admin_abuse_users.feature index a0a85470dfa..a858c492dad 100644 --- a/features/admins/users/admin_abuse_users.feature +++ b/features/admins/users/admin_abuse_users.feature @@ -158,6 +158,10 @@ Feature: Admin Abuse actions And I bookmark the work "Not Spam" And I add the work "Loads of Spam" to series "One Spam After Another" And I post the comment "I like spam" on the work "Not Spam" + And I want to edit my profile + And I fill in the details of my profile + And show me the html + And I fill in details of my default pseud And I am logged in as a "policy_and_abuse" admin When I go to the user administration page for "Spamster" And I choose "Spammer: ban and delete all creations" @@ -184,7 +188,16 @@ Feature: Admin Abuse actions And the work "Not Spam" should not be deleted And there should be no bookmarks on the work "Not Spam" And there should be no comments on the work "Not Spam" - + When I am logged in as "Spamster" + And I view my profile + Then I should not see "Test title thingy" + And I should not see "This is some text about me." + When I go to Spamster's pseuds page + Then I should not see "Description thingy" + And the icon of pseud "Spamster" should not be set + And the icon alt text of pseud "Spamster" should be blank + And the icon comment text of pseud "Spamster" should be blank + Scenario: A permabanned spammer's comments' replies from others should stay visible Given I have a work "Generic Work" And a comment "I like spam" by "Spamster" on the work "Generic Work" diff --git a/features/step_definitions/pseud_steps.rb b/features/step_definitions/pseud_steps.rb index 0b8d069fe4f..3fa20972404 100644 --- a/features/step_definitions/pseud_steps.rb +++ b/features/step_definitions/pseud_steps.rb @@ -37,3 +37,31 @@ fill_in "Name", with: newpseud click_button "Create" end + +When "I fill in details of my default pseud" do + step("I want to edit my profile") + click_link("Edit Default Pseud and Icon") + fill_in("Description", with: "Description thingy") + fill_in("Icon alt text", with: "Icon alt text thingy") + fill_in("Icon comment text", with: "Icon comment text thingy") + step("I attach an icon with the extension 'png'") + click_button("Update") +end + +Then "the icon of pseud {string} should not be set" do |pseud_name| + pseud = Pseud.find_by(name: pseud_name) + + assert !pseud.icon.attached? +end + +Then "the icon alt text of pseud {string} should be blank" do |pseud_name| + pseud = Pseud.find_by(name: pseud_name) + + assert pseud.icon_alt_text.blank? +end + +Then "the icon comment text of pseud {string} should be blank" do |pseud_name| + pseud = Pseud.find_by(name: pseud_name) + + assert pseud.icon_comment_text.blank? +end From 8acbc91e0dc20ca47a9f2604bc99d296c430cdff Mon Sep 17 00:00:00 2001 From: EchoEkhi Date: Sun, 18 Jan 2026 15:13:10 +0000 Subject: [PATCH 2/2] whoops --- app/controllers/admin/admin_users_controller.rb | 1 - features/admins/users/admin_abuse_users.feature | 1 - 2 files changed, 2 deletions(-) diff --git a/app/controllers/admin/admin_users_controller.rb b/app/controllers/admin/admin_users_controller.rb index 9fe32fa8d90..b6a310cd9d6 100644 --- a/app/controllers/admin/admin_users_controller.rb +++ b/app/controllers/admin/admin_users_controller.rb @@ -188,7 +188,6 @@ def destroy_user_creations @user.profile.about_me = nil @user.profile.save(validate: false) - @user.pseuds.each do |pseud| pseud.description = nil diff --git a/features/admins/users/admin_abuse_users.feature b/features/admins/users/admin_abuse_users.feature index a858c492dad..f2413e3a10f 100644 --- a/features/admins/users/admin_abuse_users.feature +++ b/features/admins/users/admin_abuse_users.feature @@ -160,7 +160,6 @@ Feature: Admin Abuse actions And I post the comment "I like spam" on the work "Not Spam" And I want to edit my profile And I fill in the details of my profile - And show me the html And I fill in details of my default pseud And I am logged in as a "policy_and_abuse" admin When I go to the user administration page for "Spamster"