Commit 33fb2f99 authored by Sean McGivern's avatar Sean McGivern

Merge branch '40549-render-emoj-in-groups-overview' into 'master'

Resolve "No Rendering of emoji's in Group-Overview after update"

Closes #40549

See merge request gitlab-org/gitlab-ce!16098
parents 3013951c 6185ce0c
...@@ -141,7 +141,8 @@ export default { ...@@ -141,7 +141,8 @@ export default {
<div <div
v-if="group.description" v-if="group.description"
class="description"> class="description">
{{group.description}} <span v-html="group.description">
</span>
</div> </div>
</div> </div>
<group-folder <group-folder
......
...@@ -71,7 +71,7 @@ export default class GroupsStore { ...@@ -71,7 +71,7 @@ export default class GroupsStore {
id: rawGroupItem.id, id: rawGroupItem.id,
name: rawGroupItem.name, name: rawGroupItem.name,
fullName: rawGroupItem.full_name, fullName: rawGroupItem.full_name,
description: rawGroupItem.description, description: rawGroupItem.markdown_description,
visibility: rawGroupItem.visibility, visibility: rawGroupItem.visibility,
avatarUrl: rawGroupItem.avatar_url, avatarUrl: rawGroupItem.avatar_url,
relativePath: rawGroupItem.relative_path, relativePath: rawGroupItem.relative_path,
......
class GroupChildEntity < Grape::Entity class GroupChildEntity < Grape::Entity
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
include RequestAwareEntity include RequestAwareEntity
include MarkupHelper
expose :id, :name, :description, :visibility, :full_name, expose :id, :name, :description, :visibility, :full_name,
:created_at, :updated_at, :avatar_url :created_at, :updated_at, :avatar_url
...@@ -59,6 +60,10 @@ class GroupChildEntity < Grape::Entity ...@@ -59,6 +60,10 @@ class GroupChildEntity < Grape::Entity
number_with_delimiter(instance.member_count) number_with_delimiter(instance.member_count)
end end
expose :markdown_description do |instance|
markdown_description
end
private private
def membership def membership
...@@ -74,4 +79,8 @@ class GroupChildEntity < Grape::Entity ...@@ -74,4 +79,8 @@ class GroupChildEntity < Grape::Entity
def type def type
object.class.name.downcase object.class.name.downcase
end end
def markdown_description
markdown_field(object, :description)
end
end end
---
title: Rendering of emoji's in Group-Overview
merge_request: 16098
author: Jacopo Beschi @jacopo-beschi
type: added
...@@ -55,4 +55,20 @@ feature 'Group show page' do ...@@ -55,4 +55,20 @@ feature 'Group show page' do
end end
end end
end end
context 'group has a project with emoji in description', :js do
let(:user) { create(:user) }
let!(:project) { create(:project, description: ':smile:', namespace: group) }
before do
group.add_owner(user)
sign_in(user)
visit path
end
it 'shows the project info' do
expect(page).to have_content(project.title)
expect(page).to have_selector('gl-emoji[data-name="smile"]')
end
end
end end
...@@ -22,6 +22,7 @@ describe GroupChildEntity do ...@@ -22,6 +22,7 @@ describe GroupChildEntity do
avatar_url avatar_url
name name
description description
markdown_description
visibility visibility
type type
can_edit can_edit
...@@ -60,9 +61,10 @@ describe GroupChildEntity do ...@@ -60,9 +61,10 @@ describe GroupChildEntity do
end end
describe 'for a group', :nested_groups do describe 'for a group', :nested_groups do
let(:description) { 'Awesomeness' }
let(:object) do let(:object) do
create(:group, :nested, :with_avatar, create(:group, :nested, :with_avatar,
description: 'Awesomeness') description: description)
end end
before do before do
...@@ -96,6 +98,14 @@ describe GroupChildEntity do ...@@ -96,6 +98,14 @@ describe GroupChildEntity do
expect(json[:edit_path]).to eq(edit_group_path(object)) expect(json[:edit_path]).to eq(edit_group_path(object))
end end
context 'emoji in description' do
let(:description) { ':smile:' }
it 'has the correct markdown_description' do
expect(json[:markdown_description]).to eq('<p dir="auto"><gl-emoji title="smiling face with open mouth and smiling eyes" data-name="smile" data-unicode-version="6.0">😄</gl-emoji></p>')
end
end
it_behaves_like 'group child json' it_behaves_like 'group child json'
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment