mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
UX: we should always simply use emoji codes as opposed to treating as image
This commit is contained in:
parent
04bea0c9d6
commit
e01dc54f2a
3 changed files with 3 additions and 4 deletions
|
@ -14,7 +14,6 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
|||
@markdown_images = options[:markdown_images] == true
|
||||
@keep_newlines = options[:keep_newlines] == true
|
||||
@keep_emoji_images = options[:keep_emoji_images] == true
|
||||
@keep_emoji_codes = options[:keep_emoji_codes] == true
|
||||
@start_excerpt = false
|
||||
end
|
||||
|
||||
|
@ -54,7 +53,7 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
|||
if attributes["class"] == 'emoji'
|
||||
if @keep_emoji_images
|
||||
return include_tag(name, attributes)
|
||||
elsif @keep_emoji_codes
|
||||
else
|
||||
return characters(attributes["alt"])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ module Onebox
|
|||
topic = post.topic
|
||||
slug = Slug.for(topic.title)
|
||||
|
||||
excerpt = post.excerpt(SiteSetting.post_onebox_maxlength, { keep_emoji_codes: true })
|
||||
excerpt = post.excerpt(SiteSetting.post_onebox_maxlength)
|
||||
excerpt.gsub!("\n"," ")
|
||||
# hack to make it render for now
|
||||
excerpt.gsub!("[/quote]", "[quote]")
|
||||
|
|
|
@ -263,7 +263,7 @@ HTML
|
|||
|
||||
it "should have an option to preserve emoji codes" do
|
||||
emoji_code = "<img src='/images/emoji/emoji_one/heart.png?v=1' title=':heart:' class='emoji' alt=':heart:'>"
|
||||
expect(PrettyText.excerpt(emoji_code, 100, { keep_emoji_codes: true })).to eq(":heart:")
|
||||
expect(PrettyText.excerpt(emoji_code, 100)).to eq(":heart:")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue