dmails: fix feedback not being left when spammer is autobanned.

This commit is contained in:
evazion
2019-08-22 21:20:51 -05:00
parent 4f5d80bb60
commit 6ba3d68792
2 changed files with 3 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ class Ban < ApplicationRecord
end
def update_user_on_create
user.update_attribute(:is_banned, true)
user.update!(is_banned: true)
end
def update_user_on_destroy
@@ -122,7 +122,7 @@ class Ban < ApplicationRecord
end
def create_feedback
user.feedback.create(category: "negative", body: "Banned for #{humanized_duration}: #{reason}")
user.feedback.create!(creator: banner, category: "negative", body: "Banned for #{humanized_duration}: #{reason}")
end
def create_ban_mod_action

View File

@@ -42,6 +42,7 @@ class DmailTest < ActiveSupport::TestCase
assert_equal(true, @spammer.reload.is_banned)
assert_equal(1, @spammer.bans.count)
assert_match(/Spambot./, @spammer.bans.last.reason)
assert_match(/Spambot./, @spammer.feedback.last.body)
end
end