comments: remove 2 comments per hour limit.

Remove the rule that Members could only post 2 bumping comments per
hour.

This was frequently misunderstood as meaning that Members could only
post 2 comments per hour. In fact, Members could post an unlimited
number of comments per hour, but the rest of their comments had to be
non-bumping. The error message we showed to users was misleading. Even
our own code misunderstood what this did when describing the config
option.

Gold users also weren't subject to this limit, which was unfair since
Gold users aren't any better at commenting than regular users. The fact
that a large number of users already ignored bump limits and nobody
really noticed indicates that the limit was unnecessary.
This commit is contained in:
evazion
2021-01-22 04:29:24 -06:00
parent 2eecf4d695
commit 9d71ece55d
6 changed files with 0 additions and 27 deletions

View File

@@ -1,5 +1,4 @@
class Comment < ApplicationRecord
validate :validate_creator_is_not_limited, :on => :create
validates_presence_of :body, :message => "has no content"
belongs_to :post
belongs_to :creator, class_name: "User"
@@ -46,12 +45,6 @@ class Comment < ApplicationRecord
extend SearchMethods
def validate_creator_is_not_limited
if creator.is_comment_limited? && !do_not_bump_post?
errors.add(:base, "You can only post #{Danbooru.config.member_comment_limit} comments per hour")
end
end
def autoreport_spam
if SpamDetector.new(self).spam?
moderation_reports << ModerationReport.new(creator: User.system, reason: "Spam.")

View File

@@ -490,14 +490,6 @@ class User < ApplicationRecord
User.max_saved_searches(level)
end
def is_comment_limited?
if is_gold?
false
else
Comment.where("creator_id = ? and created_at > ?", id, 1.hour.ago).count >= Danbooru.config.member_comment_limit
end
end
def is_appeal_limited?
return false if can_upload_free?
upload_limit.free_upload_slots < UploadLimit::APPEAL_COST

View File

@@ -64,7 +64,6 @@ class UserPolicy < ApplicationPolicy
custom_style favorite_count api_regen_multiplier
api_burst_limit remaining_api_limit statement_timeout
favorite_group_limit favorite_limit tag_query_limit
is_comment_limited?
max_saved_searches theme
]
end

View File

@@ -102,11 +102,6 @@ module Danbooru
40
end
# Members cannot post more than X comments in an hour.
def member_comment_limit
2
end
# Maximum size of an upload. If you change this, you must also change
# `client_max_body_size` in your nginx.conf.
def max_file_size

View File

@@ -9,7 +9,6 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
Danbooru.config.stubs(:member_comment_limit).returns(100)
end
teardown do

View File

@@ -16,7 +16,6 @@ class CommentTest < ActiveSupport::TestCase
context "that mentions a user" do
setup do
@post = FactoryBot.create(:post)
Danbooru.config.stubs(:member_comment_limit).returns(100)
end
context "added in an edit" do
@@ -82,10 +81,6 @@ class CommentTest < ActiveSupport::TestCase
end
context "created by an unlimited user" do
setup do
Danbooru.config.stubs(:member_comment_limit).returns(100)
end
context "that is then deleted" do
setup do
@post = FactoryBot.create(:post)