flags: disallow flagging pending posts.

This commit is contained in:
evazion
2017-05-19 14:37:38 -05:00
parent a4220854a3
commit 2259506bc2
3 changed files with 22 additions and 0 deletions

View File

@@ -158,6 +158,7 @@ class PostFlag < ActiveRecord::Base
end
def validate_post
errors[:post] << "is pending and cannot be flagged" if post.is_pending? && !is_deletion
errors[:post] << "is locked and cannot be flagged" if post.is_status_locked?
errors[:post] << "is deleted" if post.is_deleted?
end