From eb6a17f587fff742f38e1604cce4b32dbb775039 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Fri, 11 Mar 2016 13:36:31 +0530 Subject: [PATCH] UX: show emoji in topic title on groups page --- app/assets/javascripts/discourse/models/group.js.es6 | 1 + .../discourse/templates/components/group-post.hbs | 2 +- app/serializers/group_post_serializer.rb | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/models/group.js.es6 b/app/assets/javascripts/discourse/models/group.js.es6 index a34c6dccae5..c2369960d5d 100644 --- a/app/assets/javascripts/discourse/models/group.js.es6 +++ b/app/assets/javascripts/discourse/models/group.js.es6 @@ -130,6 +130,7 @@ const Group = Discourse.Model.extend({ return Discourse.ajax(`/groups/${this.get('name')}/${type}.json`, { data: data }).then(posts => { return posts.map(p => { p.user = Discourse.User.create(p.user); + p.topic = Discourse.Topic.create(p.topic); return Em.Object.create(p); }); }); diff --git a/app/assets/javascripts/discourse/templates/components/group-post.hbs b/app/assets/javascripts/discourse/templates/components/group-post.hbs index 78abb6b538e..0a379019e10 100644 --- a/app/assets/javascripts/discourse/templates/components/group-post.hbs +++ b/app/assets/javascripts/discourse/templates/components/group-post.hbs @@ -3,7 +3,7 @@
{{avatar post.user imageSize="large" extraClasses="actor" ignoreTitle="true"}}
{{format-date post.created_at leaveAgo="true"}} - {{unbound post.title}} + {{topic-link post.topic}} {{category-link post.category}}
diff --git a/app/serializers/group_post_serializer.rb b/app/serializers/group_post_serializer.rb index c9e37bdc07d..ad4806d8707 100644 --- a/app/serializers/group_post_serializer.rb +++ b/app/serializers/group_post_serializer.rb @@ -6,6 +6,7 @@ class GroupPostSerializer < ApplicationSerializer :url, :user_title, :user_long_name, + :topic, :category has_one :user, serializer: BasicUserSerializer, embed: :objects @@ -26,8 +27,11 @@ class GroupPostSerializer < ApplicationSerializer SiteSetting.enable_names? end + def topic + object.topic + end + def category object.topic.category end end -