better comment creation errors

This commit is contained in:
Toks
2013-04-02 13:31:57 -04:00
parent 1f68505477
commit a5f1a6bad1
3 changed files with 17 additions and 4 deletions

View File

@@ -424,10 +424,16 @@ class User < ActiveRecord::Base
def can_comment?
if is_privileged?
true
elsif created_at > Danbooru.config.member_comment_time_threshold
else
created_at <= Danbooru.config.member_comment_time_threshold
end
end
def is_comment_limited?
if is_privileged?
false
else
Comment.where("creator_id = ? and created_at > ?", id, 1.hour.ago).count < Danbooru.config.member_comment_limit
Comment.where("creator_id = ? and created_at > ?", id, 1.hour.ago).count >= Danbooru.config.member_comment_limit
end
end