From: Tom Hughes Date: Sun, 15 Sep 2024 18:37:48 +0000 (+0100) Subject: Replace creation_ip with creation_address X-Git-Tag: live~121^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/fe96c0a524c9ce092eed8e8ac14e6f9309e778cc?hp=33c0e95ebea3aeabae694ad5d9f0250dd11b56fb Replace creation_ip with creation_address --- 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