diff --git a/app/models/post.rb b/app/models/post.rb index 436e84812..4a1d1ba99 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -202,6 +202,14 @@ def locked? false end + # The test here is for flags that are pending (no status). A spam flag + # could be marked helpful but the post wouldn't be deleted, and + # we don't necessarily want the post to be treated like it's a spam risk + # if that happens. + def spam_flag_pending? + flags.any? { |flag| flag.post_flag_type&.name == "it's spam" && !flag.status } + end + # @param user [User, Nil] # @return [Boolean] whether the given user can view this post def can_access?(user) diff --git a/app/views/posts/_expanded.html.erb b/app/views/posts/_expanded.html.erb index 4a4258d60..5f28e9d23 100644 --- a/app/views/posts/_expanded.html.erb +++ b/app/views/posts/_expanded.html.erb @@ -145,8 +145,17 @@ on <%= post.locked_at.strftime('%b %e, %Y at %H:%M') %>.
- <% end %> + <% end %> + <% if post.spam_flag_pending? && user_signed_in? %> +Your post has been flagged by members of our community. Please review our guidelines for promotional content.
+ <% else %> +Possible spam: this post has pending flags for spam. Be careful when following links.
+ <% end %> +