Merge branch 'master' of github.com:r888888888/danbooru
This commit is contained in:
@@ -96,6 +96,10 @@ class AnonymousUser
|
||||
false
|
||||
end
|
||||
|
||||
def is_comment_limited?
|
||||
true
|
||||
end
|
||||
|
||||
def can_remove_from_pools?
|
||||
false
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>The site is down for maintenance.</h1>
|
||||
<p>Check <a href="https://twitter.com/search?q=%23danbooru%20from%3Ateruyo&src=typd">Twitter</a> for updates.</p>
|
||||
<p>Check <a href="https://twitter.com/search/realtime?q=%23danbooru%20from%3Ateruyo&src=typd">Twitter</a> for updates.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user