2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
class TopicLinkSerializer < ApplicationSerializer
|
|
|
|
|
2013-02-26 00:42:20 +08:00
|
|
|
attributes :url,
|
|
|
|
:title,
|
2018-06-19 14:13:14 +08:00
|
|
|
# :fancy_title,
|
2013-02-26 00:42:20 +08:00
|
|
|
:internal,
|
2015-05-28 17:37:49 +08:00
|
|
|
:attachment,
|
2013-02-26 00:42:20 +08:00
|
|
|
:reflection,
|
|
|
|
:clicks,
|
2014-04-06 02:47:25 +08:00
|
|
|
:user_id,
|
2017-11-29 16:24:27 +08:00
|
|
|
:domain,
|
|
|
|
:root_domain,
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2015-05-28 17:37:49 +08:00
|
|
|
def attachment
|
2018-06-19 14:13:14 +08:00
|
|
|
Discourse.store.has_been_uploaded?(object.url)
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
2013-02-20 05:08:23 +08:00
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
def include_user_id?
|
2018-06-19 14:13:14 +08:00
|
|
|
object.user_id.present?
|
2014-04-06 02:47:25 +08:00
|
|
|
end
|
|
|
|
|
2017-11-29 16:24:27 +08:00
|
|
|
def root_domain
|
|
|
|
MiniSuffix.domain(domain)
|
|
|
|
end
|
|
|
|
|
2013-02-07 23:45:24 +08:00
|
|
|
end
|