mod actions: fix messages to use consistent format.
Fix mod actions to use the same message format everywhere. Before mod actions were formatted in various inconsistent ways: * "deleted post #1234" * "comment #1234 updated by <user>" * "<user> updated forum #1234" * "<user> level changed Member -> Builder" Now all mod actions consistently use this format: * "deleted post #1234" * "updated comment #1234" * "updated forum #1234" * "promoted <user> from Member to Builder" This way mod actions are formatted consistently with other actions on the /user_actions page, where everything is written as "<user> did X". Also add a fix script to fix existing mod actions.
This commit is contained in:
@@ -106,7 +106,7 @@ class PostVoteTest < ActiveSupport::TestCase
|
||||
vote = create(:post_vote, post: @post, score: 1)
|
||||
|
||||
vote.soft_delete!(updater: admin)
|
||||
assert_match(/admin deleted post vote #\d+ on post #\d+/, ModAction.post_vote_delete.last.description)
|
||||
assert_match(/deleted post vote #\d+ on post #\d+/, ModAction.post_vote_delete.last.description)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -128,7 +128,7 @@ class PostVoteTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "leave a mod action" do
|
||||
assert_match(/admin undeleted post vote #\d+ on post #\d+/, ModAction.post_vote_undelete.last.description)
|
||||
assert_match(/undeleted post vote #\d+ on post #\d+/, ModAction.post_vote_undelete.last.description)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,6 +67,11 @@ class UserDeletionTest < ActiveSupport::TestCase
|
||||
assert_equal(false, @user.authenticate_password("password"))
|
||||
end
|
||||
|
||||
should "generate a modaction" do
|
||||
@deletion.delete!
|
||||
assert_match(/deleted user ##{@user.id}/, ModAction.last.description)
|
||||
end
|
||||
|
||||
should "remove any favorites" do
|
||||
@post = create(:post)
|
||||
Favorite.create!(post: @post, user: @user)
|
||||
|
||||
Reference in New Issue
Block a user