FIX: SearchLog: Do not store IP of logged in users

This commit is contained in:
riking 2018-05-21 11:48:06 -07:00 committed by Sam
parent 94124ee2a6
commit 1de0ef137e
2 changed files with 15 additions and 1 deletions

View File

@ -41,6 +41,7 @@ class SearchLog < ActiveRecord::Base
search_type = search_types[search_type]
return [:error] unless search_type.present? && ip_address.present?
ip_address = nil if user_id
key = redis_key(user_id: user_id, ip_address: ip_address)
result = nil
@ -143,7 +144,7 @@ end
# id :integer not null, primary key
# term :string not null
# user_id :integer
# ip_address :inet not null
# ip_address :inet
# search_result_id :integer
# search_type :integer not null
# created_at :datetime not null

View File

@ -0,0 +1,13 @@
class AllowNullIpSearchLog < ActiveRecord::Migration[5.1]
def up
begin
Migration::SafeMigrate.disable!
change_column :search_logs, :ip_address, :inet, null: true
ensure
Migration::SafeMigrate.enable!
end
end
def down
end
end