diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index eafd3f2fe..057337633 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -96,6 +96,10 @@ class AnonymousUser false end + def is_comment_limited? + true + end + def can_remove_from_pools? false end diff --git a/app/models/comment.rb b/app/models/comment.rb index 6c4fd6faa..defc95abf 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -86,10 +86,13 @@ class Comment < ActiveRecord::Base end def validate_creator_is_not_limited - if creator.can_comment? + if creator.is_comment_limited? && !do_not_bump_post? + errors.add(:base, "You can only post #{Danbooru.config.member_comment_limit} comments per hour") + false + elsif creator.can_comment? true else - errors.add(:creator, "can not post comments within 1 week of sign up, and can only post #{Danbooru.config.member_comment_limit} comments per hour after that") + errors.add(:base, "You can not post comments within 1 week of sign up") false end end diff --git a/app/models/user.rb b/app/models/user.rb index 239c93004..3cbb9c694 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/public/maintenance.html.bak b/public/maintenance.html.bak index 879a6251c..5e1810fe5 100644 --- a/public/maintenance.html.bak +++ b/public/maintenance.html.bak @@ -16,6 +16,6 @@
Check Twitter for updates.
+Check Twitter for updates.