mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Replace emoji in local oneboxes
This commit is contained in:
parent
ff12b5bf57
commit
621f7e0a65
3 changed files with 9 additions and 4 deletions
|
@ -93,7 +93,7 @@ module Onebox
|
||||||
|
|
||||||
quote = post.excerpt(SiteSetting.post_onebox_maxlength)
|
quote = post.excerpt(SiteSetting.post_onebox_maxlength)
|
||||||
args = { original_url: url,
|
args = { original_url: url,
|
||||||
title: topic.title,
|
title: PrettyText.unescape_emoji(topic.title),
|
||||||
avatar: PrettyText.avatar_img(topic.user.avatar_template, 'tiny'),
|
avatar: PrettyText.avatar_img(topic.user.avatar_template, 'tiny'),
|
||||||
posts_count: topic.posts_count,
|
posts_count: topic.posts_count,
|
||||||
last_post: FreedomPatches::Rails4.time_ago_in_words(topic.last_posted_at, false, scope: :'datetime.distance_in_words_verbose'),
|
last_post: FreedomPatches::Rails4.time_ago_in_words(topic.last_posted_at, false, scope: :'datetime.distance_in_words_verbose'),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class='title'>
|
<div class='title'>
|
||||||
<div class='quote-controls'></div>
|
<div class='quote-controls'></div>
|
||||||
{{{avatar}}}
|
{{{avatar}}}
|
||||||
<a href="{{original_url}}">{{title}}</a> {{{category_html}}}
|
<a href="{{original_url}}">{{{title}}}</a> {{{category_html}}}
|
||||||
</div>
|
</div>
|
||||||
<blockquote>{{{quote}}}
|
<blockquote>{{{quote}}}
|
||||||
<div class='topic-info'>
|
<div class='topic-info'>
|
||||||
|
|
|
@ -60,11 +60,16 @@ describe Onebox::Engine::DiscourseLocalOnebox do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns a link if not allowed to see the post" do
|
it "returns a link if not allowed to see the post" do
|
||||||
url = "#{topic.url}"
|
url = topic.url
|
||||||
Guardian.any_instance.stubs(:can_see?).returns(false)
|
Guardian.any_instance.stubs(:can_see?).returns(false)
|
||||||
expect(Onebox.preview(url).to_s).to eq("<a href='#{url}'>#{url}</a>")
|
expect(Onebox.preview(url).to_s).to eq("<a href='#{url}'>#{url}</a>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "replaces emoji in the title" do
|
||||||
|
topic.update_column(:title, "Who wants to eat a :hamburger:")
|
||||||
|
expect(Onebox.preview(topic.url).to_s).to match(/hamburger.png/)
|
||||||
|
end
|
||||||
|
|
||||||
it "returns some onebox goodness if post exists and can be seen" do
|
it "returns some onebox goodness if post exists and can be seen" do
|
||||||
SiteSetting.external_system_avatars_enabled = false
|
SiteSetting.external_system_avatars_enabled = false
|
||||||
url = "#{topic.url}"
|
url = "#{topic.url}"
|
||||||
|
|
Loading…
Reference in a new issue