UX: keep emojis in excerpts in flag queue

This commit is contained in:
Régis Hanol 2017-08-14 15:16:47 +02:00
parent 2f3f5477b0
commit 89e919ec42
2 changed files with 4 additions and 2 deletions

View File

@ -131,7 +131,7 @@ module FlagQuery
private private
def self.excerpt(cooked) def self.excerpt(cooked)
excerpt = Post.excerpt(cooked, 200) excerpt = Post.excerpt(cooked, 200, keep_emoji_images: true)
# remove the first link if it's the first node # remove the first link if it's the first node
fragment = Nokogiri::HTML.fragment(excerpt) fragment = Nokogiri::HTML.fragment(excerpt)
if fragment.children.first == fragment.css("a:first").first && fragment.children.first if fragment.children.first == fragment.css("a:first").first && fragment.children.first

View File

@ -29,12 +29,13 @@ describe FlagQuery do
PostAction.act(codinghorror, post, PostActionType.types[:spam]) PostAction.act(codinghorror, post, PostActionType.types[:spam])
PostAction.act(user2, post, PostActionType.types[:spam]) PostAction.act(user2, post, PostActionType.types[:spam])
mod_message = PostAction.act(user3, post, PostActionType.types[:notify_moderators], message: "this is a 10") mod_message = PostAction.act(user3, post, PostActionType.types[:notify_moderators], message: "this is a :one::zero:")
PostAction.act(codinghorror, post2, PostActionType.types[:spam]) PostAction.act(codinghorror, post2, PostActionType.types[:spam])
PostAction.act(user2, post2, PostActionType.types[:spam]) PostAction.act(user2, post2, PostActionType.types[:spam])
posts, topics, users = FlagQuery.flagged_posts_report(admin, "") posts, topics, users = FlagQuery.flagged_posts_report(admin, "")
expect(posts.count).to eq(2) expect(posts.count).to eq(2)
first = posts.first first = posts.first
@ -47,6 +48,7 @@ describe FlagQuery do
expect(second[:post_actions].count).to eq(3) expect(second[:post_actions].count).to eq(3)
expect(second[:post_actions].first[:permalink]).to eq(mod_message.related_post.topic.relative_url) expect(second[:post_actions].first[:permalink]).to eq(mod_message.related_post.topic.relative_url)
expect(second[:post_actions].first[:conversation][:response][:excerpt]).to match("<img src=")
posts, users = FlagQuery.flagged_posts_report(admin, "", 1) posts, users = FlagQuery.flagged_posts_report(admin, "", 1)
expect(posts.count).to eq(1) expect(posts.count).to eq(1)