2013-02-05 14:16:51 -05:00
|
|
|
class TopicLinkSerializer < ApplicationSerializer
|
|
|
|
|
2013-02-25 11:42:20 -05:00
|
|
|
attributes :url,
|
|
|
|
:title,
|
2013-02-19 16:08:23 -05:00
|
|
|
:fancy_title,
|
2013-02-25 11:42:20 -05:00
|
|
|
:internal,
|
2015-05-28 05:37:49 -04:00
|
|
|
:attachment,
|
2013-02-25 11:42:20 -05:00
|
|
|
:reflection,
|
|
|
|
:clicks,
|
2014-04-05 14:47:25 -04:00
|
|
|
:user_id,
|
|
|
|
:domain
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
def url
|
|
|
|
object['url']
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
object['title']
|
|
|
|
end
|
|
|
|
|
2013-02-19 16:08:23 -05:00
|
|
|
def fancy_title
|
|
|
|
object['fancy_title']
|
|
|
|
end
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
def internal
|
|
|
|
object['internal'] == 't'
|
|
|
|
end
|
|
|
|
|
2015-05-28 05:37:49 -04:00
|
|
|
def attachment
|
|
|
|
Discourse.store.has_been_uploaded?(object['url'])
|
|
|
|
end
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
def reflection
|
|
|
|
object['reflection'] == 't'
|
|
|
|
end
|
|
|
|
|
|
|
|
def clicks
|
2014-03-07 14:43:29 -05:00
|
|
|
object['clicks'].to_i
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def user_id
|
|
|
|
object['user_id'].to_i
|
|
|
|
end
|
2013-02-19 16:08:23 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
def include_user_id?
|
|
|
|
object['user_id'].present?
|
|
|
|
end
|
|
|
|
|
2014-04-05 14:47:25 -04:00
|
|
|
def domain
|
|
|
|
object['domain']
|
|
|
|
end
|
|
|
|
|
2013-02-07 10:45:24 -05:00
|
|
|
end
|