diff --git a/app/models/comment.rb b/app/models/comment.rb index ca4231caa..a402fcbc2 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -83,8 +83,6 @@ class Comment < ApplicationRecord 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") - elsif !creator.can_comment? - errors.add(:base, "You can not post comments within 1 week of sign up") end end diff --git a/app/models/user.rb b/app/models/user.rb index 2cfd430e5..45b985e5b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -394,14 +394,6 @@ class User < ApplicationRecord end end - def can_comment? - if is_gold? - true - else - created_at <= Danbooru.config.member_comment_time_threshold - end - end - def is_comment_limited? if is_gold? false @@ -506,7 +498,7 @@ class User < ApplicationRecord api_burst_limit remaining_api_limit statement_timeout favorite_group_limit favorite_limit tag_query_limit is_comment_limited? - can_comment? max_saved_searches theme + max_saved_searches theme ] end diff --git a/app/views/static/terms_of_service.html.erb b/app/views/static/terms_of_service.html.erb index 9c06e00d5..f3eded118 100644 --- a/app/views/static/terms_of_service.html.erb +++ b/app/views/static/terms_of_service.html.erb @@ -13,9 +13,9 @@
-
Post/Comment Limiting
-

You cannot upload a post or comment during the first week of signing up.

-

After the initial period, you can post up to two comments an hour and a variable number of posts based on how many of your previous uploads were approved or deleted.

+
Post Limiting
+

You cannot upload a post during the first week of signing up.

+

After the initial period, you can post a variable number of posts based on how many of your previous uploads were approved or deleted.

diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 0a29b2d7d..6a15f1c60 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -133,10 +133,6 @@ module Danbooru 40000 end - def member_comment_time_threshold - 1.week.ago - end - # https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration # https://guides.rubyonrails.org/configuring.html#configuring-action-mailer def mail_delivery_method diff --git a/test/functional/comment_votes_controller_test.rb b/test/functional/comment_votes_controller_test.rb index 6f7496779..ef2dda3da 100644 --- a/test/functional/comment_votes_controller_test.rb +++ b/test/functional/comment_votes_controller_test.rb @@ -5,7 +5,6 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest setup do CurrentUser.user = @user = create(:user) CurrentUser.ip_addr = "127.0.0.1" - Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) @comment = create(:comment) end diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index a72ffe353..8686b5cb3 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_time_threshold).returns(1.week.from_now) Danbooru.config.stubs(:member_comment_limit).returns(100) end diff --git a/test/functional/moderator/dashboards_controller_test.rb b/test/functional/moderator/dashboards_controller_test.rb index a1a11a851..4657c4aa2 100644 --- a/test/functional/moderator/dashboards_controller_test.rb +++ b/test/functional/moderator/dashboards_controller_test.rb @@ -8,7 +8,6 @@ module Moderator @user = create(:gold_user) end @admin = create(:admin_user) - Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) end context "show action" do diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index ce01abb09..18bba141b 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -17,7 +17,6 @@ class CommentTest < ActiveSupport::TestCase setup do @post = FactoryBot.create(:post) Danbooru.config.stubs(:member_comment_limit).returns(100) - Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) end context "added in an edit" do @@ -82,24 +81,9 @@ class CommentTest < ActiveSupport::TestCase end end - context "created by a limited user" do - setup do - Danbooru.config.stubs(:member_comment_limit).returns(5) - Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.ago) - end - - should "fail creation" do - post = FactoryBot.create(:post) - comment = FactoryBot.build(:comment, post: post) - comment.save - assert_equal(["You can not post comments within 1 week of sign up"], comment.errors.full_messages) - end - end - context "created by an unlimited user" do setup do Danbooru.config.stubs(:member_comment_limit).returns(100) - Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) end context "that is then deleted" do diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index e1a6a69dd..6da35b4d2 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -40,7 +40,6 @@ class UserTest < ActiveSupport::TestCase end should "limit comment votes" do - Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) Danbooru.config.stubs(:member_comment_limit).returns(10) assert(@user.can_comment_vote?) @@ -51,18 +50,6 @@ class UserTest < ActiveSupport::TestCase assert(@user.can_comment_vote?) end - should "limit comments" do - assert(!@user.can_comment?) - @user.update_column(:level, User::Levels::GOLD) - assert(@user.can_comment?) - @user.update_column(:level, User::Levels::MEMBER) - @user.update_column(:created_at, 1.year.ago) - assert(@user.can_comment?) - assert(!@user.is_comment_limited?) - create_list(:comment, Danbooru.config.member_comment_limit, creator: @user) - assert(@user.is_comment_limited?) - end - should "authenticate" do assert(User.authenticate(@user.name, "password"), "Authentication should have succeeded") assert(!User.authenticate(@user.name, "password2"), "Authentication should not have succeeded")