mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 23:06:57 +08:00
FIX: render emoji in topic title
This commit is contained in:
parent
5cb64810cd
commit
30a8c5cca2
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user