mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Initial release of Discourse
This commit is contained in:
commit
21b5628528
2932 changed files with 143949 additions and 0 deletions
32
app/serializers/topic_link_serializer.rb
Normal file
32
app/serializers/topic_link_serializer.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
class TopicLinkSerializer < ApplicationSerializer
|
||||
|
||||
attributes :url, :title, :internal, :reflection, :clicks, :user_id
|
||||
|
||||
def url
|
||||
object['url']
|
||||
end
|
||||
|
||||
def title
|
||||
object['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
|
Loading…
Add table
Add a link
Reference in a new issue