mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
defer view creation on so updates are not performed when people navigate to topics
This commit is contained in:
17
app/jobs/regular/view_tracker.rb
Normal file
17
app/jobs/regular/view_tracker.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module Jobs
|
||||
|
||||
# Asynchronously send an email to a user
|
||||
class ViewTracker < Jobs::Base
|
||||
def execute(args)
|
||||
topic_id = args[:topic_id]
|
||||
user_id = args[:user_id]
|
||||
ip = args[:ip]
|
||||
track_visit = args[:track_visit]
|
||||
|
||||
View.create_for_parent(Topic, topic_id, ip, user_id)
|
||||
if track_visit
|
||||
TopicUser.track_visit! topic_id, user_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user