This commit is contained in:
r888888888
2017-03-17 12:13:27 -07:00
parent 998a6494ed
commit ecdea34323
2 changed files with 8 additions and 6 deletions

View File

@@ -95,10 +95,12 @@ class PostFlag < ActiveRecord::Base
end
def validate_creator_is_not_limited
if creator.created_at > 1.week.ago
if CurrentUser.can_approve_posts?
# do nothing
elsif creator.created_at > 1.week.ago
errors[:creator] << "cannot flag within the first week of sign up"
elsif creator.is_gold? && flag_count_for_creator >= 5
errors[:creator] << "can flag 5 posts a day"
elsif creator.is_gold? && flag_count_for_creator >= 10
errors[:creator] << "can flag 10 posts a day"
elsif !creator.is_gold? && flag_count_for_creator >= 1
errors[:creator] << "can flag 1 post a day"
end