FIX: convert emoji to unicode on event title (#530)
This commit is contained in:
parent
b49e327f5c
commit
dea70ab377
|
@ -24,6 +24,10 @@ module DiscoursePostEvent
|
|||
},
|
||||
}
|
||||
|
||||
if post_hash[:topic][:title].match?(/:[\w\-+]+:/)
|
||||
post_hash[:topic][:title] = Emoji.gsub_emoji_to_unicode(post_hash[:topic][:title])
|
||||
end
|
||||
|
||||
if JSON.parse(SiteSetting.map_events_to_color).size > 0
|
||||
post_hash[:topic][:category_slug] = object.post.topic&.category&.slug
|
||||
post_hash[:topic][:tags] = object.post.topic.tags&.map(&:name)
|
||||
|
|
|
@ -8,7 +8,7 @@ describe DiscoursePostEvent::EventSummarySerializer do
|
|||
end
|
||||
|
||||
fab!(:category)
|
||||
fab!(:topic) { Fabricate(:topic, category: category) }
|
||||
fab!(:topic) { Fabricate(:topic, category: category, title: "Topic title :tada:") }
|
||||
fab!(:post) { Fabricate(:post, topic: topic) }
|
||||
fab!(:event) { Fabricate(:event, post: post) }
|
||||
|
||||
|
@ -20,7 +20,7 @@ describe DiscoursePostEvent::EventSummarySerializer do
|
|||
expect(summary[:timezone]).to eq(event.timezone)
|
||||
expect(summary[:name]).to eq(event.name)
|
||||
expect(summary[:post][:url]).to eq(post.url)
|
||||
expect(summary[:post][:topic][:title]).to eq(topic.title)
|
||||
expect(summary[:post][:topic][:title]).to eq("Topic title 🎉")
|
||||
expect(summary[:category_id]).to eq(category.id)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue