FIX: unescape emojis in digests

This commit is contained in:
Régis Hanol 2015-10-15 09:59:29 +02:00
parent 03f9668d60
commit 73e345fe8f
3 changed files with 14 additions and 2 deletions

View file

@ -74,6 +74,10 @@ module ApplicationHelper
end
end
def unescape_emoji(title)
PrettyText.unescape_emoji(title)
end
def with_format(format, &block)
old_formats = formats
self.formats = [format]

View file

@ -20,7 +20,7 @@
<%- @featured_topics.each_with_index do |t, i| %>
<div class='featured-topic'>
<%= link_to t.title, "#{Discourse.base_url}#{t.relative_url}" %>
<a href='<%= Discourse.base_url + t.relative_url %>'><%= raw unescape_emoji(t.title) %></a>
<br/>
<%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</div>
@ -43,7 +43,7 @@
<%- @new_topics.each do |t| %>
<ul>
<li>
<%= link_to t.title, "#{Discourse.base_url}#{t.relative_url}" %>
<a href='<%= Discourse.base_url + t.relative_url %>'><%= raw unescape_emoji(t.title) %></a>
<span class='post-count'><%= t.posts_count %></span>
<%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</li>

View file

@ -226,6 +226,14 @@ module PrettyText
end
end
def self.unescape_emoji(title)
protect do
v8["title"] = title
decorate_context(v8)
v8.eval("Discourse.Emoji.unescape(title)")
end
end
def self.cook(text, opts={})
options = opts.dup