This commit is contained in:
r888888888
2013-08-02 16:55:30 -07:00
parent ac487e5fab
commit df9c087e85
2 changed files with 26 additions and 11 deletions

View File

@@ -61,21 +61,19 @@ class PostFlag < ActiveRecord::Base
def validate_creator_is_not_limited
if CurrentUser.is_janitor?
false
elsif flag_count_for_creator >= 10
# 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 >= 10
errors[:creator] << "can flag 10 posts a day"
false
else
true
elsif !creator.is_gold? && flag_count_for_creator >= 1
errors[:creator] << "can flag 1 post a day"
end
end
def validate_post_is_active
if post.is_deleted?
errors[:post] << "is deleted"
false
else
true
end
end