FIX: Keep emoji images in group bio excerpt (#8329)

This commit is contained in:
Dan Ungureanu 2019-11-11 18:42:08 +02:00 committed by GitHub
parent 544a1379b6
commit 6672dcc985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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?

View File

@ -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 <img')
end
end
end