dmails: fix feedback not being left when spammer is autobanned.
This commit is contained in:
@@ -89,7 +89,7 @@ class Ban < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_user_on_create
|
def update_user_on_create
|
||||||
user.update_attribute(:is_banned, true)
|
user.update!(is_banned: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_user_on_destroy
|
def update_user_on_destroy
|
||||||
@@ -122,7 +122,7 @@ class Ban < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_feedback
|
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
|
end
|
||||||
|
|
||||||
def create_ban_mod_action
|
def create_ban_mod_action
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class DmailTest < ActiveSupport::TestCase
|
|||||||
assert_equal(true, @spammer.reload.is_banned)
|
assert_equal(true, @spammer.reload.is_banned)
|
||||||
assert_equal(1, @spammer.bans.count)
|
assert_equal(1, @spammer.bans.count)
|
||||||
assert_match(/Spambot./, @spammer.bans.last.reason)
|
assert_match(/Spambot./, @spammer.bans.last.reason)
|
||||||
|
assert_match(/Spambot./, @spammer.feedback.last.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user