From 6672dcc985a56a8b357a9fa3590311cecbcff75f Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Mon, 11 Nov 2019 18:42:08 +0200 Subject: [PATCH] FIX: Keep emoji images in group bio excerpt (#8329) --- app/serializers/basic_group_serializer.rb | 2 +- spec/serializers/basic_group_serializer_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/serializers/basic_group_serializer.rb b/app/serializers/basic_group_serializer.rb index d3c012194a2..df250920d8a 100644 --- a/app/serializers/basic_group_serializer.rb +++ b/app/serializers/basic_group_serializer.rb @@ -45,7 +45,7 @@ class BasicGroupSerializer < ApplicationSerializer end def bio_excerpt - PrettyText.excerpt(object.bio_cooked, 110) if object.bio_cooked.present? + PrettyText.excerpt(object.bio_cooked, 110, keep_emoji_images: true) if object.bio_cooked.present? end def include_incoming_email? diff --git a/spec/serializers/basic_group_serializer_spec.rb b/spec/serializers/basic_group_serializer_spec.rb index 3dace7fcf44..b905f5d4a12 100644 --- a/spec/serializers/basic_group_serializer_spec.rb +++ b/spec/serializers/basic_group_serializer_spec.rb @@ -26,7 +26,7 @@ describe BasicGroupSerializer do end describe '#bio_raw' do - fab!(:group) { Fabricate(:group, bio_raw: 'testing') } + fab!(:group) { Fabricate(:group, bio_raw: 'testing :slightly_smiling_face:') } subject do described_class.new(group, scope: guardian, root: false, owner_group_ids: [group.id]) @@ -34,7 +34,8 @@ describe BasicGroupSerializer do describe 'group owner' do it 'should include bio_raw' do - expect(subject.as_json[:bio_raw]).to eq('testing') + expect(subject.as_json[:bio_raw]).to eq('testing :slightly_smiling_face:') + expect(subject.as_json[:bio_excerpt]).to start_with('testing