pundit: convert forum topics / forum posts to pundit.
Fix it being possible for users to delete or undelete their own forum posts and topics, even if they were deleted by a mod.
This commit is contained in:
@@ -102,25 +102,6 @@ class ForumPostTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "belonging to a locked topic" do
|
||||
setup do
|
||||
@post = create(:forum_post, topic: @topic, body: "zzz")
|
||||
@topic.update(is_locked: true)
|
||||
end
|
||||
|
||||
should "not be updateable" do
|
||||
@post.update(body: "xxx")
|
||||
assert_equal(true, @post.invalid?)
|
||||
assert_equal("zzz", @post.reload.body)
|
||||
end
|
||||
|
||||
should "not be deletable" do
|
||||
@post.delete!
|
||||
assert_equal(true, @post.invalid?)
|
||||
assert_equal(false, @post.reload.is_deleted)
|
||||
end
|
||||
end
|
||||
|
||||
should "update the topic when created" do
|
||||
@original_topic_updated_at = @topic.updated_at
|
||||
travel(1.second) do
|
||||
|
||||
Reference in New Issue
Block a user