Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/controllers/admin/admin_users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion features/admins/users/admin_abuse_users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
28 changes: 28 additions & 0 deletions features/step_definitions/pseud_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading