comments: allow new users to comment.
Remove the rule that users less than a week old can't leave comments.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user