mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: missing avatars from categories page when ajax loaded
UX: display last poster on categories page instead of OP
This commit is contained in:
parent
50379183e1
commit
55fad7b339
2 changed files with 15 additions and 3 deletions
|
@ -2,9 +2,9 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-topic-id={{topic.id}} class="{{if topic.archived 'archived'}}">
|
<tr data-topic-id={{topic.id}} class="{{if topic.archived 'archived'}}">
|
||||||
<td class="topic-poster">
|
<td class="topic-poster">
|
||||||
{{#with topic.creator as |op|}}
|
{{#with topic.lastPoster as |lastPoster|}}
|
||||||
{{#user-link user=op}}
|
{{#user-link user=lastPoster}}
|
||||||
{{avatar op imageSize="large"}}
|
{{avatar lastPoster imageSize="large"}}
|
||||||
{{/user-link}}
|
{{/user-link}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
class CategoryAndTopicListsSerializer < ApplicationSerializer
|
class CategoryAndTopicListsSerializer < ApplicationSerializer
|
||||||
has_one :category_list, serializer: CategoryListSerializer, embed: :objects
|
has_one :category_list, serializer: CategoryListSerializer, embed: :objects
|
||||||
has_one :topic_list, serializer: TopicListSerializer, embed: :objects
|
has_one :topic_list, serializer: TopicListSerializer, embed: :objects
|
||||||
|
has_many :users, serializer: BasicUserSerializer, embed: :objects
|
||||||
|
|
||||||
|
def users
|
||||||
|
users = object.topic_list.topics.map do |t|
|
||||||
|
t.posters.map{|poster| poster.try(:user)}
|
||||||
|
end
|
||||||
|
users.flatten!
|
||||||
|
users.compact!
|
||||||
|
users.uniq!(&:id)
|
||||||
|
users
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue