]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'pull/5218'
authorAnton Khorev <tony29@yandex.ru>
Mon, 16 Sep 2024 12:17:27 +0000 (15:17 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 16 Sep 2024 12:17:27 +0000 (15:17 +0300)
app/controllers/users_controller.rb
app/models/user.rb
app/views/users/_user.html.erb
app/views/users/show.html.erb
script/update-spam-blocks
test/controllers/users_controller_test.rb

index fc893c9c3194f6c40a65ce61e1d73e9824ba0747..63a83ad1da8ad9803c3980ade89dbe0755398bea 100644 (file)
@@ -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
index 441805f390e4c4a206aff7bb5bf23ba9bed41173..6b54182569415d58040cb738b6b93766ce93bcf1 100644 (file)
@@ -15,7 +15,6 @@
 #  pass_salt            :string
 #  email_valid          :boolean          default(FALSE), not null
 #  new_email            :string
-#  creation_ip          :string
 #  languages            :string
 #  status               :enum             default("pending"), not null
 #  terms_agreed         :datetime
@@ -50,6 +49,8 @@ class User < ApplicationRecord
   require "digest"
   include AASM
 
+  self.ignored_columns += ["creation_ip"]
+
   has_many :traces, -> { where(:visible => true) }
   has_many :diary_entries, -> { order(:created_at => :desc) }, :inverse_of => :user
   has_many :diary_comments, -> { order(:created_at => :desc) }, :inverse_of => :user
index ef50ccaf2fb4bffa27c19ce8950fbbd6b7e13209..2fb14b6bdf7056f2196e4c476905f49480e0d758 100644 (file)
@@ -4,10 +4,10 @@
   </td>
   <td>
     <p>
-      <% 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",
index 44319b384f4ac313b39502b99150e05d2ce08ef8..d479b1d56dad13e0ab1e94e5188f8b6331ccf2cd 100644 (file)
             <dl class="list-inline">
               <dt class="list-inline-item m-0"><%= t ".email address" %></dt>
               <dd class="list-inline-item"><%= @user.email %></dd>
-              <% unless @user.creation_ip.nil? -%>
+              <% unless @user.creation_address.nil? -%>
                 <dt class="list-inline-item m-0"><%= t ".created from" %></dt>
-                <dd class="list-inline-item"><%= link_to @user.creation_ip, users_path(:ip => @user.creation_ip) %></dd>
+                <dd class="list-inline-item"><%= link_to @user.creation_address, users_path(:ip => @user.creation_address) %></dd>
               <% end -%>
               <dt class="list-inline-item m-0"><%= t ".status" %></dt>
               <dd class="list-inline-item"><%= link_to @user.status.capitalize, users_path(:status => @user.status) %></dd>
index b5656f6ac0b5b7aad20208084b990789985fdc9b..7d665454582a842ebb09d6bf2d313dcee955a64d 100755 (executable)
@@ -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|
index 4f4edf10b034a82ad562b995bbb5328ab6db0382..dda157f01552cbcbc62664b64183d9e83ed56ae8 100644 (file)
@@ -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