FIX: render emoji in topic title

This commit is contained in:
Arpit Jalan 2017-04-12 00:41:23 +05:30 committed by Sam
parent 5cb64810cd
commit 30a8c5cca2
2 changed files with 12 additions and 2 deletions

View File

@ -19,7 +19,7 @@ const TopicRoute = Discourse.Route.extend({
titleToken() {
const model = this.modelFor('topic');
if (model) {
const result = model.get('title'),
const result = model.get('unicode_title') ? model.get('unicode_title') : model.get('title'),
cat = model.get('category');
// Only display uncategorized in the title tag if it was renamed

View File

@ -3,6 +3,7 @@ require_dependency 'new_post_manager'
class TopicViewSerializer < ApplicationSerializer
include PostStreamSerializerMixin
include ApplicationHelper
def self.attributes_from_topic(*list)
[list].flatten.each do |attribute|
@ -58,7 +59,8 @@ class TopicViewSerializer < ApplicationSerializer
:message_archived,
:tags,
:featured_link,
:topic_status_update
:topic_status_update,
:unicode_title
# TODO: Split off into proper object / serializer
def details
@ -264,4 +266,12 @@ class TopicViewSerializer < ApplicationSerializer
object.topic.featured_link
end
def include_unicode_title?
!!(object.topic.title =~ /:([\w\-+]*):/)
end
def unicode_title
gsub_emoji_to_unicode(object.topic.title)
end
end