FIX: Don't count draft views towards topic view stats (#28162)

When creating a shared draft, we're recording topic view stats on the draft and then pass those on when the draft is published, conflating the actual view count.

This fixes that by not registering topic views if the topic is a shared draft.
This commit is contained in:
Ted Johansson
2024-07-31 11:10:50 +08:00
committed by GitHub
parent 78f8b7ba99
commit a32390f5dc
4 changed files with 28 additions and 0 deletions

View File

@ -1308,6 +1308,7 @@ class TopicsController < ApplicationController
Scheduler::Defer.later "Topic View" do
topic = Topic.find_by(id: topic_id)
next if topic.blank?
next if topic.shared_draft?
# We need to make sure that we aren't allowing recording
# random topic views against topics the user cannot see.