From fe96c0a524c9ce092eed8e8ac14e6f9309e778cc Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 15 Sep 2024 19:37:48 +0100 Subject: [PATCH 1/1] Replace creation_ip with creation_address --- app/controllers/users_controller.rb | 3 +-- app/views/users/_user.html.erb | 4 ++-- app/views/users/show.html.erb | 4 ++-- script/update-spam-blocks | 2 +- test/controllers/users_controller_test.rb | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fc893c9c3..63a83ad1d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -36,7 +36,7 @@ class UsersController < ApplicationController users = User.all users = users.where(:status => @params[:status]) if @params[:status] - users = users.where(:creation_ip => @params[:ip]) if @params[:ip] + users = users.where(:creation_address => @params[:ip]) if @params[:ip] @users_count = users.limit(501).count @users_count = I18n.t("count.at_least_pattern", :count => 500) if @users_count > 500 @@ -268,7 +268,6 @@ class UsersController < ApplicationController def save_new_user(email_hmac, referer = nil) current_user.data_public = true current_user.description = "" if current_user.description.nil? - current_user.creation_ip = request.remote_ip current_user.creation_address = request.remote_ip current_user.languages = http_accept_language.user_preferred_languages current_user.terms_agreed = Time.now.utc diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index ef50ccaf2..2fb14b6bd 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -4,10 +4,10 @@

- <% if user.creation_ip %> + <% if user.creation_address %> <%= t "users.index.summary_html", :name => link_to(user.display_name, user), - :ip_address => link_to(user.creation_ip, :ip => user.creation_ip), + :ip_address => link_to(user.creation_address, :ip => user.creation_address), :date => l(user.created_at, :format => :friendly) %> <% else %> <%= t "users.index.summary_no_ip_html", diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 44319b384..d479b1d56 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -217,9 +217,9 @@

<%= t ".email address" %>
<%= @user.email %>
- <% unless @user.creation_ip.nil? -%> + <% unless @user.creation_address.nil? -%>
<%= t ".created from" %>
-
<%= link_to @user.creation_ip, users_path(:ip => @user.creation_ip) %>
+
<%= link_to @user.creation_address, users_path(:ip => @user.creation_address) %>
<% end -%>
<%= t ".status" %>
<%= link_to @user.status.capitalize, users_path(:status => @user.status) %>
diff --git a/script/update-spam-blocks b/script/update-spam-blocks index b5656f6ac..7d6654545 100755 --- a/script/update-spam-blocks +++ b/script/update-spam-blocks @@ -8,7 +8,7 @@ addresses = User.count( :status => %w[suspended deleted], :creation_time => Time.now.utc - 28.days..Time.now.utc }, - :group => :creation_ip + :group => :creation_address ) addresses.each do |address, count| diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 4f4edf10b..dda157f01 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -476,7 +476,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest moderator_user = create(:moderator_user) administrator_user = create(:administrator_user) _suspended_user = create(:user, :suspended) - _ip_user = create(:user, :creation_ip => "1.2.3.4") + _ip_user = create(:user, :creation_address => "1.2.3.4") # There are now 7 users - the five above, plus two extra "granters" for the # moderator_user and administrator_user -- 2.39.5