dmails: fix feedback not being left when spammer is autobanned.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user