mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: IncomingLink: do not log IP of logged-in users
This commit is contained in:
parent
e474351ae4
commit
cdcb0a396f
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue