forum topics: don't record a topic visit for api requests.

This commit is contained in:
evazion
2017-05-13 13:50:20 -05:00
parent 78b08d8394
commit 71a19c28f1
3 changed files with 13 additions and 3 deletions

View File

@@ -103,8 +103,8 @@ class ForumTopic < ActiveRecord::Base
ForumTopicVisit.where("user_id = ? and forum_topic_id = ? and last_read_at >= ?", user.id, id, updated_at).exists?
end
def mark_as_read!(user = nil)
user ||= CurrentUser.user
def mark_as_read!(user = CurrentUser.user)
return if user.is_anonymous?
match = ForumTopicVisit.where(:user_id => user.id, :forum_topic_id => id).first
if match