FIX: Don't track user profile view when viewed by system user.
This commit is contained in:
parent
f19232646f
commit
17f0727b04
|
@ -7,6 +7,7 @@ class UserProfileView < ActiveRecord::Base
|
||||||
at ||= Time.zone.now
|
at ||= Time.zone.now
|
||||||
redis_key = "user-profile-view:#{user_profile_id}:#{at.to_date}"
|
redis_key = "user-profile-view:#{user_profile_id}:#{at.to_date}"
|
||||||
if user_id
|
if user_id
|
||||||
|
return if user_id < 1
|
||||||
redis_key << ":user-#{user_id}"
|
redis_key << ":user-#{user_id}"
|
||||||
else
|
else
|
||||||
redis_key << ":ip-#{ip}"
|
redis_key << ":ip-#{ip}"
|
||||||
|
|
|
@ -36,4 +36,9 @@ RSpec.describe UserProfileView do
|
||||||
expect(described_class.count).to eq(1)
|
expect(described_class.count).to eq(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should not create a profile view for the system user" do
|
||||||
|
add(user_profile_id, '1.1.1.1', Discourse::SYSTEM_USER_ID)
|
||||||
|
expect(described_class.count).to eq(0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue