mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 01:22:36 +08:00
44 lines
605 B
Ruby
44 lines
605 B
Ruby
class TopicLinkSerializer < ApplicationSerializer
|
|
|
|
attributes :url,
|
|
:title,
|
|
:fancy_title,
|
|
:internal,
|
|
:reflection,
|
|
:clicks,
|
|
:user_id
|
|
|
|
def url
|
|
object['url']
|
|
end
|
|
|
|
def title
|
|
object['title']
|
|
end
|
|
|
|
def fancy_title
|
|
object['fancy_title']
|
|
end
|
|
|
|
def internal
|
|
object['internal'] == 't'
|
|
end
|
|
|
|
def reflection
|
|
object['reflection'] == 't'
|
|
end
|
|
|
|
def clicks
|
|
object['clicks'] || 0
|
|
end
|
|
|
|
def user_id
|
|
object['user_id'].to_i
|
|
end
|
|
|
|
def include_user_id?
|
|
object['user_id'].present?
|
|
end
|
|
|
|
end
|