diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e574a2dc5..d39fb25db 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -39,7 +39,7 @@ class ApplicationController < ActionController::Base before_action(only: action, if: if_proc) do key = "#{controller_name}:#{action}" - rate_limiter = RateLimiter.build(action: key, rate: rate, burst: burst, user: CurrentUser.user, ip_addr: CurrentUser.ip_addr) + rate_limiter = RateLimiter.build(action: key, rate: rate, burst: burst, user: CurrentUser.user, ip_addr: request.remote_ip) headers["X-Rate-Limit"] = rate_limiter.to_json rate_limiter.limit! end @@ -101,7 +101,7 @@ class ApplicationController < ActionController::Base rate: CurrentUser.user.api_regen_multiplier, burst: 200, user: CurrentUser.user, - ip_addr: CurrentUser.ip_addr, + ip_addr: request.remote_ip, ) headers["X-Rate-Limit"] = rate_limiter.to_json @@ -178,7 +178,6 @@ class ApplicationController < ActionController::Base def reset_current_user CurrentUser.user = nil - CurrentUser.ip_addr = nil CurrentUser.safe_mode = false end @@ -215,7 +214,7 @@ class ApplicationController < ActionController::Base end def ip_ban_check - raise User::PrivilegeError if !request.get? && IpBan.hit!(:full, CurrentUser.ip_addr) + raise User::PrivilegeError if !request.get? && IpBan.hit!(:full, request.remote_ip) end def pundit_user diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 870d085e0..6b0525c2f 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -43,7 +43,7 @@ class CommentsController < ApplicationController end def create - @comment = authorize Comment.new(creator: CurrentUser.user, creator_ip_addr: CurrentUser.ip_addr) + @comment = authorize Comment.new(creator: CurrentUser.user, creator_ip_addr: request.remote_ip) @comment.update(permitted_attributes(@comment)) flash[:notice] = @comment.valid? ? "Comment posted" : @comment.errors.full_messages.join("; ") respond_with(@comment) do |format| diff --git a/app/controllers/dmails_controller.rb b/app/controllers/dmails_controller.rb index 51ea38e0c..b3b4bb6be 100644 --- a/app/controllers/dmails_controller.rb +++ b/app/controllers/dmails_controller.rb @@ -38,7 +38,7 @@ class DmailsController < ApplicationController end def create - @dmail = authorize(Dmail).create_split(from: CurrentUser.user, creator_ip_addr: CurrentUser.ip_addr, **permitted_attributes(Dmail)) + @dmail = authorize(Dmail).create_split(from: CurrentUser.user, creator_ip_addr: request.remote_ip, **permitted_attributes(Dmail)) respond_with(@dmail) end diff --git a/app/controllers/forum_posts_controller.rb b/app/controllers/forum_posts_controller.rb index e293b01c6..ad28713b1 100644 --- a/app/controllers/forum_posts_controller.rb +++ b/app/controllers/forum_posts_controller.rb @@ -38,7 +38,7 @@ class ForumPostsController < ApplicationController end def create - @forum_post = authorize ForumPost.new(creator: CurrentUser.user, creator_ip_addr: CurrentUser.ip_addr, topic_id: params.dig(:forum_post, :topic_id)) + @forum_post = authorize ForumPost.new(creator: CurrentUser.user, creator_ip_addr: request.remote_ip, topic_id: params.dig(:forum_post, :topic_id)) @forum_post.update(permitted_attributes(@forum_post)) page = @forum_post.topic.last_page if @forum_post.topic.last_page > 1 diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index d6aa47816..913df8142 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -58,7 +58,7 @@ class ForumTopicsController < ApplicationController def create @forum_topic = authorize ForumTopic.new(creator: CurrentUser.user, **permitted_attributes(ForumTopic)) @forum_topic.original_post.creator = CurrentUser.user - @forum_topic.original_post.creator_ip_addr = CurrentUser.ip_addr + @forum_topic.original_post.creator_ip_addr = request.remote_ip @forum_topic.save respond_with(@forum_topic) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3b9cd93ac..29b1eb17d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -65,7 +65,7 @@ class UsersController < ApplicationController user_verifier = UserVerifier.new(CurrentUser.user, request) @user = authorize User.new( - last_ip_addr: CurrentUser.ip_addr, + last_ip_addr: request.remote_ip, last_logged_in_at: Time.zone.now, requires_verification: user_verifier.requires_verification?, level: user_verifier.initial_level, diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index d74442722..c8cc1851c 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -11,7 +11,7 @@ class ApplicationJob < ActiveJob::Base queue_with_priority 0 around_perform do |_job, block| - CurrentUser.scoped(User.system, "127.0.0.1") do + CurrentUser.scoped(User.system) do ApplicationRecord.without_timeout do Timeout.timeout(24.hours, JobTimeoutError) do block.call diff --git a/app/logical/bulk_update_request_processor.rb b/app/logical/bulk_update_request_processor.rb index baf34dd7d..dab562bda 100644 --- a/app/logical/bulk_update_request_processor.rb +++ b/app/logical/bulk_update_request_processor.rb @@ -184,7 +184,7 @@ class BulkUpdateRequestProcessor # Process the bulk update request immediately. def process! - CurrentUser.scoped(User.system, "127.0.0.1") do + CurrentUser.scoped(User.system) do commands.map do |command, *args| case command when :create_alias diff --git a/app/logical/session_loader.rb b/app/logical/session_loader.rb index da4abfe49..9bfb1a010 100644 --- a/app/logical/session_loader.rb +++ b/app/logical/session_loader.rb @@ -66,7 +66,6 @@ class SessionLoader # @see CurrentUser def load CurrentUser.user = User.anonymous - CurrentUser.ip_addr = request.remote_ip if has_api_authentication? load_session_for_api diff --git a/app/models/application_record.rb b/app/models/application_record.rb index a1996b067..fccce823b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -217,14 +217,13 @@ class ApplicationRecord < ActiveRecord::Base end current_user = CurrentUser.user - current_ip = CurrentUser.ip_addr find_in_batches(batch_size: batch_size, error_on_ignore: true) do |batch| Parallel.each(batch, in_processes: in_processes, in_threads: in_threads) do |record| # XXX In threaded mode, the current user isn't inherited from the # parent thread because the current user is a thread-local # variable. Hence, we have to set it explicitly in the child thread. - CurrentUser.scoped(current_user, current_ip) do + CurrentUser.scoped(current_user) do yield record end end diff --git a/db/populate.rb b/db/populate.rb index a1c6bd67e..102c1eb3e 100644 --- a/db/populate.rb +++ b/db/populate.rb @@ -24,7 +24,6 @@ FAVORITES = ENV.fetch("FAVORITES", POSTS * 5.0).to_i DEFAULT_PASSWORD = ENV.fetch("DEFAULT_PASSWORD", "password") CurrentUser.user = User.system -CurrentUser.ip_addr = "127.0.0.1" def populate_users(n, password: DEFAULT_PASSWORD) puts "*** Creating users ***" diff --git a/test/functional/comment_votes_controller_test.rb b/test/functional/comment_votes_controller_test.rb index eba9d3713..8cda53192 100644 --- a/test/functional/comment_votes_controller_test.rb +++ b/test/functional/comment_votes_controller_test.rb @@ -4,13 +4,11 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest context "A comment votes controller" do setup do CurrentUser.user = @user = create(:user, name: "cirno") - CurrentUser.ip_addr = "127.0.0.1" @comment = create(:comment, creator: @user) end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "index action" do diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index 82a5d64c9..771893507 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -8,12 +8,10 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest @post = create(:post, id: 100) CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "index action" do diff --git a/test/functional/dmails_controller_test.rb b/test/functional/dmails_controller_test.rb index bc2628920..f1dfca28c 100644 --- a/test/functional/dmails_controller_test.rb +++ b/test/functional/dmails_controller_test.rb @@ -10,7 +10,6 @@ class DmailsControllerTest < ActionDispatch::IntegrationTest teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "new action" do diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index a4eeae803..273ffcd4a 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -243,12 +243,10 @@ class PostsControllerTest < ActionDispatch::IntegrationTest context "with a pool: search" do setup do CurrentUser.user = create(:user) - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "render for a pool: search" do @@ -278,12 +276,10 @@ class PostsControllerTest < ActionDispatch::IntegrationTest context "with a favgroup: search" do setup do CurrentUser.user = create(:user) - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "render for a favgroup: search" do diff --git a/test/unit/application_record.rb b/test/unit/application_record.rb index 5f36f6cc8..0a8b2e50a 100644 --- a/test/unit/application_record.rb +++ b/test/unit/application_record.rb @@ -28,18 +28,15 @@ class ApplicationRecordTest < ActiveSupport::TestCase @user1 = create(:user) @user2 = create(:user) - CurrentUser.scoped(@user1, "1.1.1.1") do + CurrentUser.scoped(@user1) do Tag.parallel_each do |tag| assert_equal(@user1, CurrentUser.user) - assert_equal("1.1.1.1", CurrentUser.ip_addr) - CurrentUser.scoped(@user2, "2.2.2.2") do + CurrentUser.scoped(@user2) do assert_equal(@user2, CurrentUser.user) - assert_equal("2.2.2.2", CurrentUser.ip_addr) end assert_equal(@user1, CurrentUser.user) - assert_equal("1.1.1.1", CurrentUser.ip_addr) end end end diff --git a/test/unit/artist_commentary_test.rb b/test/unit/artist_commentary_test.rb index 9d9e67cc3..7319b073f 100644 --- a/test/unit/artist_commentary_test.rb +++ b/test/unit/artist_commentary_test.rb @@ -4,12 +4,10 @@ class ArtistCommentaryTest < ActiveSupport::TestCase setup do user = FactoryBot.create(:user) CurrentUser.user = user - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "A post should not have more than one commentary" do diff --git a/test/unit/artist_test.rb b/test/unit/artist_test.rb index b91c72da9..16324b1fe 100644 --- a/test/unit/artist_test.rb +++ b/test/unit/artist_test.rb @@ -17,12 +17,10 @@ class ArtistTest < ActiveSupport::TestCase setup do user = travel_to(1.month.ago) {FactoryBot.create(:user)} CurrentUser.user = user - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "parse inactive urls" do diff --git a/test/unit/artist_url_test.rb b/test/unit/artist_url_test.rb index 25bd55641..6483b85fb 100644 --- a/test/unit/artist_url_test.rb +++ b/test/unit/artist_url_test.rb @@ -8,12 +8,10 @@ class ArtistURLTest < ActiveSupport::TestCase context "An artist url" do setup do CurrentUser.user = FactoryBot.create(:user) - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "allow urls to be marked as inactive" do diff --git a/test/unit/ban_test.rb b/test/unit/ban_test.rb index 1bd1c72e8..11df1024e 100644 --- a/test/unit/ban_test.rb +++ b/test/unit/ban_test.rb @@ -6,13 +6,11 @@ class BanTest < ActiveSupport::TestCase setup do @banner = FactoryBot.create(:admin_user) CurrentUser.user = @banner - CurrentUser.ip_addr = "127.0.0.1" end teardown do @banner = nil CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "set the is_banned flag on the user" do @@ -54,7 +52,6 @@ class BanTest < ActiveSupport::TestCase context "Searching for a ban" do should "find a given ban" do CurrentUser.user = FactoryBot.create(:admin_user) - CurrentUser.ip_addr = "127.0.0.1" user = FactoryBot.create(:user) ban = FactoryBot.create(:ban, user: user) @@ -76,13 +73,11 @@ class BanTest < ActiveSupport::TestCase setup do @admin = FactoryBot.create(:admin_user) CurrentUser.user = @admin - CurrentUser.ip_addr = "127.0.0.1" @user = FactoryBot.create(:user) end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end end end diff --git a/test/unit/bulk_update_request_test.rb b/test/unit/bulk_update_request_test.rb index 8fa1425a5..1bf03143b 100644 --- a/test/unit/bulk_update_request_test.rb +++ b/test/unit/bulk_update_request_test.rb @@ -12,12 +12,10 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase setup do @admin = FactoryBot.create(:admin_user) CurrentUser.user = @admin - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should_eventually "parse tags with tag type prefixes inside the script" do diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 178215f48..8ae12ddb3 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -5,12 +5,10 @@ class CommentTest < ActiveSupport::TestCase setup do user = FactoryBot.create(:user) CurrentUser.user = user - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "that mentions a user" do diff --git a/test/unit/current_user_test.rb b/test/unit/current_user_test.rb index 5561a6226..dadcf0ed9 100644 --- a/test/unit/current_user_test.rb +++ b/test/unit/current_user_test.rb @@ -3,7 +3,6 @@ require 'test_helper' class CurrentUserTest < ActiveSupport::TestCase setup do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "The current user" do @@ -11,14 +10,11 @@ class CurrentUserTest < ActiveSupport::TestCase user = FactoryBot.create(:user) assert_nil(CurrentUser.user) - assert_nil(CurrentUser.ip_addr) CurrentUser.user = user - CurrentUser.ip_addr = "1.2.3.4" assert_not_nil(CurrentUser.user) assert_equal(user.id, CurrentUser.user.id) - assert_equal("1.2.3.4", CurrentUser.ip_addr) end end @@ -27,7 +23,7 @@ class CurrentUserTest < ActiveSupport::TestCase user1 = FactoryBot.create(:user) user2 = FactoryBot.create(:user) CurrentUser.user = user1 - CurrentUser.scoped(user2, nil) do + CurrentUser.scoped(user2) do assert_equal(user2.id, CurrentUser.user.id) end assert_equal(user1.id, CurrentUser.user.id) @@ -38,7 +34,7 @@ class CurrentUserTest < ActiveSupport::TestCase user2 = FactoryBot.create(:user) CurrentUser.user = user1 assert_raises(RuntimeError) do - CurrentUser.scoped(user2, nil) do + CurrentUser.scoped(user2) do assert_equal(user2.id, CurrentUser.user.id) raise "ERROR" end diff --git a/test/unit/d_text_test.rb b/test/unit/d_text_test.rb index 023a33f91..84a0ecb59 100644 --- a/test/unit/d_text_test.rb +++ b/test/unit/d_text_test.rb @@ -46,12 +46,10 @@ class DTextTest < ActiveSupport::TestCase context "#format_text" do setup do CurrentUser.user = create(:user) - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end should "add tag types to wiki links" do diff --git a/test/unit/forum_post_test.rb b/test/unit/forum_post_test.rb index b9d0aec3e..340295493 100644 --- a/test/unit/forum_post_test.rb +++ b/test/unit/forum_post_test.rb @@ -5,13 +5,11 @@ class ForumPostTest < ActiveSupport::TestCase setup do @user = FactoryBot.create(:user) CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" @topic = FactoryBot.create(:forum_topic) end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "that mentions a user" do diff --git a/test/unit/forum_topic_test.rb b/test/unit/forum_topic_test.rb index 406171906..b7d244415 100644 --- a/test/unit/forum_topic_test.rb +++ b/test/unit/forum_topic_test.rb @@ -6,13 +6,11 @@ class ForumTopicTest < ActiveSupport::TestCase travel_to Time.now @user = FactoryBot.create(:user) CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" @topic = create(:forum_topic, title: "xxx", creator: @user) end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "#mark_as_read!" do diff --git a/test/unit/pool_test.rb b/test/unit/pool_test.rb index 430490343..a0f1e3315 100644 --- a/test/unit/pool_test.rb +++ b/test/unit/pool_test.rb @@ -6,13 +6,10 @@ class PoolTest < ActiveSupport::TestCase @user = FactoryBot.create(:user) CurrentUser.user = @user end - - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "Searching pools" do diff --git a/test/unit/post_disapproval_test.rb b/test/unit/post_disapproval_test.rb index e18ce13f4..92c3065a0 100644 --- a/test/unit/post_disapproval_test.rb +++ b/test/unit/post_disapproval_test.rb @@ -5,12 +5,10 @@ class PostDisapprovalTest < ActiveSupport::TestCase setup do @alice = FactoryBot.create(:moderator_user, name: "alice") CurrentUser.user = @alice - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "a post disapproval" do diff --git a/test/unit/post_query_builder_test.rb b/test/unit/post_query_builder_test.rb index db88135e4..803ef4bda 100644 --- a/test/unit/post_query_builder_test.rb +++ b/test/unit/post_query_builder_test.rb @@ -15,12 +15,10 @@ class PostQueryBuilderTest < ActiveSupport::TestCase setup do CurrentUser.user = create(:user) - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "Searching:" do diff --git a/test/unit/post_sets/post_test.rb b/test/unit/post_sets/post_test.rb index cb1016e26..a0c6c8be9 100644 --- a/test/unit/post_sets/post_test.rb +++ b/test/unit/post_sets/post_test.rb @@ -6,7 +6,6 @@ module PostSets setup do @user = FactoryBot.create(:user) CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" @post_1 = FactoryBot.create(:post, :tag_string => "a") @post_2 = FactoryBot.create(:post, :tag_string => "b") @@ -15,7 +14,6 @@ module PostSets teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "a set for page 2" do diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 2c895ed18..a5dff31ae 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -17,14 +17,12 @@ class PostTest < ActiveSupport::TestCase @user = FactoryBot.create(:user) end CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" end def teardown super CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "Deletion:" do diff --git a/test/unit/post_version_test.rb b/test/unit/post_version_test.rb index d514063c7..13b1dcefe 100644 --- a/test/unit/post_version_test.rb +++ b/test/unit/post_version_test.rb @@ -7,12 +7,10 @@ class PostVersionTest < ActiveSupport::TestCase @user = FactoryBot.create(:user) end CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "that has multiple versions: " do diff --git a/test/unit/related_tag_query_test.rb b/test/unit/related_tag_query_test.rb index 8c03d2627..f80b0ba5b 100644 --- a/test/unit/related_tag_query_test.rb +++ b/test/unit/related_tag_query_test.rb @@ -4,7 +4,6 @@ class RelatedTagQueryTest < ActiveSupport::TestCase setup do user = FactoryBot.create(:user) CurrentUser.user = user - CurrentUser.ip_addr = "127.0.0.1" end context "#other_wiki_pages" do diff --git a/test/unit/saved_search_test.rb b/test/unit/saved_search_test.rb index d15e6d2f0..948da6727 100644 --- a/test/unit/saved_search_test.rb +++ b/test/unit/saved_search_test.rb @@ -5,7 +5,6 @@ class SavedSearchTest < ActiveSupport::TestCase super @user = FactoryBot.create(:user) CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" @mock_redis = MockRedis.new SavedSearch.stubs(:redis).returns(@mock_redis) end @@ -13,7 +12,6 @@ class SavedSearchTest < ActiveSupport::TestCase def teardown super CurrentUser.user = nil - CurrentUser.ip_addr = nil end context ".labels_for" do diff --git a/test/unit/session_loader_test.rb b/test/unit/session_loader_test.rb index 10011ff19..a97355fc5 100644 --- a/test/unit/session_loader_test.rb +++ b/test/unit/session_loader_test.rb @@ -18,7 +18,6 @@ class SessionLoaderTest < ActiveSupport::TestCase teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil CurrentUser.safe_mode = nil end diff --git a/test/unit/sources/pixiv_test.rb b/test/unit/sources/pixiv_test.rb index 2269d5ef7..0f635d24f 100644 --- a/test/unit/sources/pixiv_test.rb +++ b/test/unit/sources/pixiv_test.rb @@ -227,7 +227,6 @@ module Sources context "translating the tags" do setup do CurrentUser.user = FactoryBot.create(:user) - CurrentUser.ip_addr = "127.0.0.1" tags = { "comic" => "漫画", diff --git a/test/unit/tag_alias_test.rb b/test/unit/tag_alias_test.rb index 6c93d6523..9806087b6 100644 --- a/test/unit/tag_alias_test.rb +++ b/test/unit/tag_alias_test.rb @@ -9,12 +9,10 @@ class TagAliasTest < ActiveSupport::TestCase user = FactoryBot.create(:user) CurrentUser.user = user end - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "on validation" do diff --git a/test/unit/tag_implication_test.rb b/test/unit/tag_implication_test.rb index 2b33b6207..d8bd8a364 100644 --- a/test/unit/tag_implication_test.rb +++ b/test/unit/tag_implication_test.rb @@ -5,12 +5,10 @@ class TagImplicationTest < ActiveSupport::TestCase setup do @admin = create(:admin_user) CurrentUser.user = @admin - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "on validation" do diff --git a/test/unit/tag_test.rb b/test/unit/tag_test.rb index 288b669ed..27b421c2c 100644 --- a/test/unit/tag_test.rb +++ b/test/unit/tag_test.rb @@ -4,12 +4,10 @@ class TagTest < ActiveSupport::TestCase setup do @builder = FactoryBot.create(:builder_user) CurrentUser.user = @builder - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "A tag category fetcher" do diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 6fe459727..0ba75f627 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -18,12 +18,10 @@ class UserTest < ActiveSupport::TestCase setup do @user = FactoryBot.create(:user) CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" end teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "promoting a user" do diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb index 4b846115b..cc8e23d61 100644 --- a/test/unit/wiki_page_test.rb +++ b/test/unit/wiki_page_test.rb @@ -1,13 +1,8 @@ require 'test_helper' class WikiPageTest < ActiveSupport::TestCase - setup do - CurrentUser.ip_addr = "127.0.0.1" - end - teardown do CurrentUser.user = nil - CurrentUser.ip_addr = nil end context "A wiki page" do