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:
evazion
2022-09-18 20:30:41 -05:00
parent 72e95b6ca3
commit 2119a8efc5
21 changed files with 224 additions and 33 deletions

View File

@@ -213,7 +213,9 @@ class ForumPostsControllerTest < ActionDispatch::IntegrationTest
should "allow moderators to update other people's posts" do
put_auth forum_post_path(@forum_post), @mod, params: { forum_post: { body: "test" }}
assert_redirected_to(forum_topic_path(@forum_topic, anchor: "forum_post_#{@forum_post.id}"))
assert_match(/updated forum ##{@forum_post.id}/, ModAction.last.description)
end
end
@@ -224,6 +226,7 @@ class ForumPostsControllerTest < ActionDispatch::IntegrationTest
assert_redirected_to(@forum_reply)
assert_equal(true, @forum_reply.reload.is_deleted?)
assert_match(/updated forum ##{@forum_reply.id}/, ModAction.last.description)
end
should "not allow users to delete their own posts" do
@@ -262,6 +265,7 @@ class ForumPostsControllerTest < ActionDispatch::IntegrationTest
assert_redirected_to(@forum_reply)
assert_equal(false, @forum_reply.reload.is_deleted?)
assert_match(/updated forum ##{@forum_reply.id}/, ModAction.last.description)
end
should "not allow users to undelete their own posts" do