diff --git a/app/models/comment.rb b/app/models/comment.rb index ded7a5008..372e7f9c4 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -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.") diff --git a/app/models/user.rb b/app/models/user.rb index f2d6361aa..8b93c5f1a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index d02848a07..faf36bec7 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -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 diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 5acece016..526891393 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -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 diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index 987e12605..7e1ae2a45 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -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 diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index a050cc5b1..178215f48 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -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)