FIX: UserProfileView: Do not log IP of logged-in users

This commit is contained in:
riking
2018-05-21 12:40:15 -07:00
committed by Sam
parent 7e8ef5d6e1
commit 501bc0e9af
3 changed files with 31 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
class UserProfileView < ActiveRecord::Base
validates_presence_of :user_profile_id, :ip_address, :viewed_at
validates_presence_of :user_profile_id, :viewed_at
belongs_to :user_profile
@@ -9,6 +9,7 @@ class UserProfileView < ActiveRecord::Base
if user_id
return if user_id < 1
redis_key << ":user-#{user_id}"
ip = nil
else
redis_key << ":ip-#{ip}"
end
@@ -59,13 +60,12 @@ end
# id :integer not null, primary key
# user_profile_id :integer not null
# viewed_at :datetime not null
# ip_address :inet not null
# ip_address :inet
# user_id :integer
#
# Indexes
#
# index_user_profile_views_on_user_id (user_id)
# index_user_profile_views_on_user_profile_id (user_profile_id)
# unique_profile_view_ip (viewed_at,ip_address,user_profile_id) UNIQUE
# unique_profile_view_user (viewed_at,user_id,user_profile_id) UNIQUE
# unique_profile_view_user_or_ip (viewed_at,user_id,ip_address,user_profile_id) UNIQUE
#