mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
4981525047
- Upgrades Ember to latest - Fixes a bunch of bugs with page titles and missing "active" states
26 lines
588 B
Ruby
26 lines
588 B
Ruby
class TopicListItemSerializer < ListableTopicSerializer
|
|
|
|
attributes :views,
|
|
:like_count,
|
|
:starred,
|
|
:has_summary,
|
|
:archetype,
|
|
:last_poster_username,
|
|
:category_id
|
|
|
|
has_many :posters, serializer: TopicPosterSerializer, embed: :objects
|
|
|
|
def starred
|
|
object.user_data.starred?
|
|
end
|
|
alias :include_starred? :seen
|
|
|
|
def posters
|
|
object.posters || []
|
|
end
|
|
|
|
def last_poster_username
|
|
object.posters.find { |poster| poster.user.id == object.last_post_user_id }.try(:user).try(:username)
|
|
end
|
|
|
|
end
|