2020-03-12 13:20:56 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative 'post_item_excerpt'
|
|
|
|
|
|
|
|
class UserBookmarkSerializer < ApplicationSerializer
|
|
|
|
include PostItemExcerpt
|
|
|
|
include TopicTagsMixin
|
|
|
|
|
|
|
|
attributes :id,
|
|
|
|
:created_at,
|
|
|
|
:topic_id,
|
|
|
|
:linked_post_number,
|
|
|
|
:post_id,
|
|
|
|
:name,
|
|
|
|
:reminder_at,
|
|
|
|
:title,
|
|
|
|
:deleted,
|
|
|
|
:hidden,
|
|
|
|
:category_id,
|
|
|
|
:closed,
|
|
|
|
:archived,
|
|
|
|
:archetype,
|
|
|
|
:highest_post_number,
|
|
|
|
:bumped_at,
|
|
|
|
:slug,
|
|
|
|
:username
|
|
|
|
|
|
|
|
def closed
|
2020-03-12 14:00:45 +08:00
|
|
|
object.topic.closed
|
2020-03-12 13:20:56 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def archived
|
2020-03-12 14:00:45 +08:00
|
|
|
object.topic.archived
|
2020-03-12 13:20:56 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def linked_post_number
|
|
|
|
object.post.post_number
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
object.topic.title
|
|
|
|
end
|
|
|
|
|
|
|
|
def deleted
|
|
|
|
object.topic.deleted_at.present? || object.post.deleted_at.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def hidden
|
|
|
|
object.post.hidden
|
|
|
|
end
|
|
|
|
|
|
|
|
def category_id
|
|
|
|
object.topic.category_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def archetype
|
|
|
|
object.topic.archetype
|
|
|
|
end
|
|
|
|
|
|
|
|
def archived
|
|
|
|
object.topic.archived
|
|
|
|
end
|
|
|
|
|
|
|
|
def closed
|
|
|
|
object.topic.closed
|
|
|
|
end
|
|
|
|
|
|
|
|
def highest_post_number
|
|
|
|
object.topic.highest_post_number
|
|
|
|
end
|
|
|
|
|
|
|
|
def bumped_at
|
|
|
|
object.topic.bumped_at
|
|
|
|
end
|
|
|
|
|
|
|
|
def raw
|
|
|
|
object.post.raw
|
|
|
|
end
|
|
|
|
|
|
|
|
def cooked
|
|
|
|
object.post.cooked
|
|
|
|
end
|
|
|
|
|
|
|
|
def slug
|
|
|
|
object.topic.slug
|
|
|
|
end
|
|
|
|
|
|
|
|
def username
|
|
|
|
object.post.user.username
|
|
|
|
end
|
|
|
|
end
|