mirror of
https://github.com/discourse/discourse.git
synced 2025-03-02 09:19:22 +00:00
* we want to be able to get these records for the bookmark even if they are trashed, for serialization for the bookmark list
92 lines
1.4 KiB
Ruby
92 lines
1.4 KiB
Ruby
# 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
|
|
object.topic.closed
|
|
end
|
|
|
|
def archived
|
|
object.topic.archived
|
|
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
|