BigW Consortium Gitlab

Commit 18ab4ac7 by Sean McGivern Committed by Lin Jen-Shin

Merge branch '29529-quick-fix' into 'master'

Ensure not valid anymore labels don't break issue pages Closes #29529 See merge request !9995
parent 16f3e29a
......@@ -44,27 +44,17 @@ module Gitlab
end
# CSS sprite fallback takes precedence over image fallback
def gl_emoji_tag(name, image: false, sprite: false, force_fallback: false)
def gl_emoji_tag(name)
emoji_name = emojis_aliases[name] || name
emoji_info = emojis[emoji_name]
emoji_fallback_image_source = ActionController::Base.helpers.url_to_image("emoji/#{emoji_info['name']}.png")
emoji_fallback_sprite_class = "emoji-#{emoji_name}"
return unless emoji_info
data = {
name: emoji_name,
unicode_version: emoji_unicode_version(emoji_name)
}
data[:fallback_src] = emoji_fallback_image_source if image
data[:fallback_sprite_class] = emoji_fallback_sprite_class if sprite
ActionController::Base.helpers.content_tag 'gl-emoji',
class: ("emoji-icon #{emoji_fallback_sprite_class}" if force_fallback && sprite),
data: data do
if force_fallback && !sprite
emoji_image_tag(emoji_name, emoji_fallback_image_source)
else
emoji_info['moji']
end
end
ActionController::Base.helpers.content_tag('gl-emoji', emoji_info['moji'], data: data)
end
end
end
......@@ -17,8 +17,21 @@ describe 'Awards Emoji', feature: true do
login_as(user)
end
describe 'visiting an issue with a legacy award emoji that is not valid anymore' do
before do
# The `heart_tip` emoji is not valid anymore so we need to skip validation
issue.award_emoji.build(user: user, name: 'heart_tip').save!(validate: false)
visit namespace_project_issue_path(project.namespace, project, issue)
end
# Regression test: https://gitlab.com/gitlab-org/gitlab-ce/issues/29529
it 'does not shows a 500 page' do
expect(page).to have_text(issue.title)
end
end
describe 'Click award emoji from issue#show' do
let!(:note) { create(:note_on_issue, noteable: issue, project: issue.project, note: "Hello world") }
let!(:note) { create(:note_on_issue, noteable: issue, project: issue.project, note: "Hello world") }
before do
visit namespace_project_issue_path(project.namespace, project, issue)
......
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