mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 00:33:42 +08:00
92e1e43104
The `unread_not_too_old` attribute is a little odd because there should never be a case where the user's first_unread_at column is less than the `Topic#updated_at` column of an unread topic. The `unread_not_too_old` attribute is causing a bug where topic states synced into `TopicTrackingState` do not appear as unread because the attribute does not exsist on a normal `Topic` object and hence never set.
23 lines
551 B
Ruby
23 lines
551 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TopicTrackingStateSerializer < ApplicationSerializer
|
|
attributes :topic_id,
|
|
:highest_post_number,
|
|
:last_read_post_number,
|
|
:created_at,
|
|
:category_id,
|
|
:notification_level,
|
|
:created_in_new_period,
|
|
:treat_as_new_topic_start_date,
|
|
:tags
|
|
|
|
def created_in_new_period
|
|
return true if !scope
|
|
object.created_at >= treat_as_new_topic_start_date
|
|
end
|
|
|
|
def include_tags?
|
|
object.respond_to?(:tags)
|
|
end
|
|
end
|