diff --git a/app/models/post.rb b/app/models/post.rb index 888e95cba..9187c3ea8 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1767,9 +1767,7 @@ class Post < ApplicationRecord end def flaggable_for_guidelines? - return true if is_pending? - return true if CurrentUser.is_privileged? && !has_tag?("grandfathered_content") && created_at.after?("2015-01-01") - false + !has_tag?("grandfathered_content") && created_at.after?("2015-01-01") end def visible_comment_count(_user) diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 8437e6f1f..63c93f3d6 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -143,7 +143,7 @@ class PostFlag < ApplicationRecord end errors.add(:parent_id, "cannot be set to the post being flagged") if parent_post.id == post.id when 'uploading_guidelines' - errors.add(:reason, "cannot be used. The post is either not pending, or grandfathered") unless post.flaggable_for_guidelines? + errors.add(:reason, "cannot be used. The post is grandfathered") unless post.flaggable_for_guidelines? else errors.add(:reason, "is not one of the available choices") unless MAPPED_REASONS.key?(reason_name) end diff --git a/test/unit/post_flag_test.rb b/test/unit/post_flag_test.rb index e6d43f02b..94f1e3335 100644 --- a/test/unit/post_flag_test.rb +++ b/test/unit/post_flag_test.rb @@ -39,15 +39,14 @@ class PostFlagTest < ActiveSupport::TestCase assert_match(/Post is deleted/, error.message) end - should "not be able to flag a non-pending post with the uploading_guidelines reason" do + should "not be able to flag grandfathered posts with the uploading_guidelines reason" do error = assert_raises(ActiveRecord::RecordInvalid) do as(@bob) do - @post_flag = create(:post_flag, post: @post, reason_name: "uploading_guidelines") + @post_flag = create(:post_flag, post: create(:post, tag_string: "grandfathered_content"), reason_name: "uploading_guidelines") end end - assert_match(/not pending/, error.message) + assert_match(/grandfathered/, error.message) - @post = create(:post, is_pending: true) as(@bob) do @post_flag = create(:post_flag, post: @post, reason_name: "uploading_guidelines") end