From 89e919ec428698e8e197a9d6c21981d8eb85d1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 14 Aug 2017 15:16:47 +0200 Subject: [PATCH] UX: keep emojis in excerpts in flag queue --- lib/flag_query.rb | 2 +- spec/components/flag_query_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/flag_query.rb b/lib/flag_query.rb index 53616e042f0..6f99431d88b 100644 --- a/lib/flag_query.rb +++ b/lib/flag_query.rb @@ -131,7 +131,7 @@ module FlagQuery private 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 fragment = Nokogiri::HTML.fragment(excerpt) if fragment.children.first == fragment.css("a:first").first && fragment.children.first diff --git a/spec/components/flag_query_spec.rb b/spec/components/flag_query_spec.rb index e6424c74ffd..58f44063c94 100644 --- a/spec/components/flag_query_spec.rb +++ b/spec/components/flag_query_spec.rb @@ -29,12 +29,13 @@ describe FlagQuery do PostAction.act(codinghorror, 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(user2, post2, PostActionType.types[:spam]) posts, topics, users = FlagQuery.flagged_posts_report(admin, "") + expect(posts.count).to eq(2) first = posts.first @@ -47,6 +48,7 @@ describe FlagQuery do 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[:conversation][:response][:excerpt]).to match("