Commit 572c050b authored by Ezekiel Kigbo's avatar Ezekiel Kigbo Committed by Heinrich Lee Yu

Default emoji icon persists in issues and mrs header

parent cac2115c
......@@ -164,6 +164,12 @@ module IssuablesHelper
h(title || default_label)
end
def issuable_meta_author_status(author)
return "" unless show_status_emoji?(author&.status) && status = user_status(author)
"#{status}".html_safe
end
def issuable_meta(issuable, project)
output = []
output << "Opened #{time_ago_with_tooltip(issuable.created_at)} by ".html_safe
......@@ -177,10 +183,7 @@ module IssuablesHelper
author_output << link_to_member(project, issuable.author, size: 24, by_username: true, avatar: false, mobile_classes: "d-inline d-sm-none")
author_output << issuable_meta_author_slot(issuable.author, css_class: 'ml-1')
if status = user_status(issuable.author)
author_output << "#{status}".html_safe
end
author_output << issuable_meta_author_status(issuable.author)
author_output
end
......
---
title: Clear emoji status in issue/mr header
merge_request: 49439
author:
type: fixed
......@@ -44,6 +44,30 @@ RSpec.describe IssuablesHelper do
end
end
describe '#issuable_meta' do
let(:user) { create(:user) }
let_it_be(:project) { create(:project) }
describe 'author status' do
let(:issuable) { build(:merge_request, source_project: project, author: user, created_at: '2020-01-30') }
it 'displays an emoji if the user status is set' do
user.status = UserStatus.new(message: 'lol')
content = helper.issuable_meta(issuable, project)
expect(content).to match('<span class="user-status-emoji has-tooltip" title="lol" data-html="true" data-placement="top">')
expect(content).to match('<gl-emoji title="speech balloon" data-name="speech_balloon" data-unicode-version="6.0">')
end
it 'does not displays an emoji if the user status is not set' do
user.status = UserStatus.new
content = helper.issuable_meta(issuable, project)
expect(content).not_to match('class="user-status-emoji has-tooltip"')
expect(content).not_to match('gl-emoji')
end
end
end
describe '#issuables_state_counter_text' do
let(:user) { create(:user) }
......
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