Merge branch 'master' of github.com:r888888888/danbooru
This commit is contained in:
@@ -96,6 +96,10 @@ class AnonymousUser
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_comment_limited?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def can_remove_from_pools?
|
def can_remove_from_pools?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -86,10 +86,13 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate_creator_is_not_limited
|
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
|
true
|
||||||
else
|
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
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -424,10 +424,16 @@ class User < ActiveRecord::Base
|
|||||||
def can_comment?
|
def can_comment?
|
||||||
if is_privileged?
|
if is_privileged?
|
||||||
true
|
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
|
false
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>The site is down for maintenance.</h1>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user