mirror of
https://github.com/discourse/discourse.git
synced 2025-02-28 08:00:53 +08:00
FIX: SearchLog: Do not store IP of logged in users
This commit is contained in:
parent
94124ee2a6
commit
1de0ef137e
@ -41,6 +41,7 @@ class SearchLog < ActiveRecord::Base
|
|||||||
search_type = search_types[search_type]
|
search_type = search_types[search_type]
|
||||||
return [:error] unless search_type.present? && ip_address.present?
|
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)
|
key = redis_key(user_id: user_id, ip_address: ip_address)
|
||||||
|
|
||||||
result = nil
|
result = nil
|
||||||
@ -143,7 +144,7 @@ end
|
|||||||
# id :integer not null, primary key
|
# id :integer not null, primary key
|
||||||
# term :string not null
|
# term :string not null
|
||||||
# user_id :integer
|
# user_id :integer
|
||||||
# ip_address :inet not null
|
# ip_address :inet
|
||||||
# search_result_id :integer
|
# search_result_id :integer
|
||||||
# search_type :integer not null
|
# search_type :integer not null
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
|
13
db/migrate/20180521184439_allow_null_ip_search_log.rb
Normal file
13
db/migrate/20180521184439_allow_null_ip_search_log.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user