mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: IncomingLink: do not log IP of logged-in users
This commit is contained in:
@@ -20,6 +20,7 @@ class IncomingLink < ActiveRecord::Base
|
|||||||
u = User.select(:id).find_by(username_lower: username.downcase)
|
u = User.select(:id).find_by(username_lower: username.downcase)
|
||||||
user_id = u.id if u
|
user_id = u.id if u
|
||||||
end
|
end
|
||||||
|
ip_address = opts[:ip_address]
|
||||||
|
|
||||||
if opts[:referer].present?
|
if opts[:referer].present?
|
||||||
begin
|
begin
|
||||||
@@ -38,6 +39,7 @@ class IncomingLink < ActiveRecord::Base
|
|||||||
.pluck(:id).first
|
.pluck(:id).first
|
||||||
|
|
||||||
cid = current_user ? (current_user.id) : (nil)
|
cid = current_user ? (current_user.id) : (nil)
|
||||||
|
ip_address = nil if cid
|
||||||
|
|
||||||
unless cid && cid == user_id
|
unless cid && cid == user_id
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ class IncomingLink < ActiveRecord::Base
|
|||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
post_id: post_id,
|
post_id: post_id,
|
||||||
current_user_id: cid,
|
current_user_id: cid,
|
||||||
ip_address: opts[:ip_address]) if post_id
|
ip_address: ip_address) if post_id
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user