DEV: Use new core code API for topic view tracking (#173)

Brings this plugin into line with the changes at
https://github.com/discourse/discourse/pull/27533,
where we have split the topic view tracking into
2 controller functions.
This commit is contained in:
Martin Brennan 2024-07-08 10:14:50 +10:00 committed by GitHub
parent 11dcab8466
commit 0d9365571b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -1,3 +1,4 @@
< 3.3.0.beta3-dev: 11dcab84669462b05eba3f1a59401727cafe8188
< 3.3.0.beta1-dev: 94c7b7da216c66d773f800a714493f087affaac9
3.1.999: a4b203274b88c5277d0b5b936de0bc0e0016726c
2.8.0.beta9: 05678c451caf2ceb192501da91cf0d24ea44c8e8

View File

@ -54,9 +54,11 @@ module Docs
ip = request.remote_ip
user_id = (current_user.id if current_user)
track_visit = should_track_visit_to_topic?
TopicsController.defer_track_visit(topic.id, ip, user_id, track_visit)
# TODO (martin) Change this to `defer_track_visit` once the core
# method is renamed.
TopicsController.defer_track_visit_v2(topic.id, user_id) if should_track_visit_to_topic?
TopicsController.defer_topic_view(topic.id, ip, user_id)
TopicViewSerializer.new(topic_view, scope: guardian, root: false)
end