2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
class TopicLinkSerializer < ApplicationSerializer
|
2013-02-25 11:42:20 -05:00
|
|
|
attributes :url,
|
|
|
|
:title,
|
2018-06-19 02:13:14 -04: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,
|
2017-11-29 03:24:27 -05:00
|
|
|
:domain,
|
2023-01-09 08:59:43 -05:00
|
|
|
:root_domain
|
|
|
|
|
|
|
|
def attachment
|
|
|
|
Discourse.store.has_been_uploaded?(object.url)
|
|
|
|
end
|
2013-02-19 16:08:23 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
def include_user_id?
|
2018-06-19 02:13:14 -04:00
|
|
|
object.user_id.present?
|
2014-04-05 14:47:25 -04:00
|
|
|
end
|
|
|
|
|
2017-11-29 03:24:27 -05:00
|
|
|
def root_domain
|
|
|
|
MiniSuffix.domain(domain)
|
|
|
|
end
|
2013-02-07 10:45:24 -05:00
|
|
|
end
|