diff --git a/app/controllers/admin/admin_users_controller.rb b/app/controllers/admin/admin_users_controller.rb index 69cb925e87e..b6a310cd9d6 100644 --- a/app/controllers/admin/admin_users_controller.rb +++ b/app/controllers/admin/admin_users_controller.rb @@ -184,6 +184,20 @@ 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..f2413e3a10f 100644 --- a/features/admins/users/admin_abuse_users.feature +++ b/features/admins/users/admin_abuse_users.feature @@ -158,6 +158,9 @@ 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 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 +187,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