FIX: IncomingLink: do not log IP of logged-in users

This commit is contained in:
riking 2018-05-14 14:29:44 -07:00 committed by Sam
parent e474351ae4
commit cdcb0a396f

View File

@ -20,6 +20,7 @@ class IncomingLink < ActiveRecord::Base
u = User.select(:id).find_by(username_lower: username.downcase)
user_id = u.id if u
end
ip_address = opts[:ip_address]
if opts[:referer].present?
begin
@ -38,6 +39,7 @@ class IncomingLink < ActiveRecord::Base
.pluck(:id).first
cid = current_user ? (current_user.id) : (nil)
ip_address = nil if cid
unless cid && cid == user_id
@ -45,7 +47,7 @@ class IncomingLink < ActiveRecord::Base
user_id: user_id,
post_id: post_id,
current_user_id: cid,
ip_address: opts[:ip_address]) if post_id
ip_address: ip_address) if post_id
end
end