mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 19:14:43 +08:00
UX: show topics where the top links are extracted from in user summary
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
class UserSummarySerializer < ApplicationSerializer
|
||||
class TopicSerializer < BasicTopicSerializer
|
||||
attributes :like_count, :slug, :created_at
|
||||
|
||||
class TopicSerializer < ApplicationSerializer
|
||||
attributes :id, :created_at, :fancy_title, :slug, :like_count
|
||||
end
|
||||
|
||||
class ReplySerializer < ApplicationSerializer
|
||||
@ -9,7 +10,12 @@ class UserSummarySerializer < ApplicationSerializer
|
||||
end
|
||||
|
||||
class LinkSerializer < ApplicationSerializer
|
||||
attributes :url, :title, :clicks, :domain
|
||||
attributes :url, :title, :clicks, :post_number
|
||||
has_one :topic, serializer: TopicSerializer
|
||||
|
||||
def post_number
|
||||
object.post.post_number
|
||||
end
|
||||
end
|
||||
|
||||
class MostLikedByUserSerializer < BasicUserSerializer
|
||||
@ -18,9 +24,9 @@ class UserSummarySerializer < ApplicationSerializer
|
||||
|
||||
has_many :topics, serializer: TopicSerializer
|
||||
has_many :replies, serializer: ReplySerializer, embed: :object
|
||||
has_many :badges, serializer: UserBadgeSerializer, embed: :object
|
||||
has_many :links, serializer: LinkSerializer, embed: :object
|
||||
has_many :most_liked_by_users, serializer: MostLikedByUserSerializer, embed: :object
|
||||
has_many :badges, serializer: UserBadgeSerializer, embed: :object
|
||||
|
||||
attributes :likes_given,
|
||||
:likes_received,
|
||||
|
Reference in New Issue
Block a user