diff --git a/app/assets/javascripts/discourse/routes/topic.js.es6 b/app/assets/javascripts/discourse/routes/topic.js.es6 index 3fcb115fbf4..bcc266dc863 100644 --- a/app/assets/javascripts/discourse/routes/topic.js.es6 +++ b/app/assets/javascripts/discourse/routes/topic.js.es6 @@ -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 diff --git a/app/serializers/topic_view_serializer.rb b/app/serializers/topic_view_serializer.rb index 848c3e3f02e..802ccad671c 100644 --- a/app/serializers/topic_view_serializer.rb +++ b/app/serializers/topic_view_serializer.rb @@ -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