| ... | @@ -42,7 +42,7 @@ module IconsHelper |
... | @@ -42,7 +42,7 @@ module IconsHelper |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def sprite_icon(icon_name, size: nil, css_class: nil)
|
|
def sprite_icon(icon_name, size: nil, css_class: nil)
|
|
|
unless known_sprites.include?(icon_name)
|
|
if known_sprites&.exclude?(icon_name)
|
|
|
exception = ArgumentError.new("#{icon_name} is not a known icon in @gitlab-org/gitlab-svg")
|
|
exception = ArgumentError.new("#{icon_name} is not a known icon in @gitlab-org/gitlab-svg")
|
|
|
Gitlab::Sentry.track_and_raise_for_dev_exception(exception)
|
|
Gitlab::Sentry.track_and_raise_for_dev_exception(exception)
|
|
|
end
|
|
end
|
| ... | @@ -156,6 +156,8 @@ module IconsHelper |
... | @@ -156,6 +156,8 @@ module IconsHelper |
|
|
private
|
|
private
|
|
|
|
|
|
|
|
def known_sprites
|
|
def known_sprites
|
|
|
|
return if Rails.env.production?
|
|
|
|
|
|
|
@known_sprites ||= JSON.parse(File.read(Rails.root.join('node_modules/@gitlab/svgs/dist/icons.json')))['icons']
|
|
@known_sprites ||= JSON.parse(File.read(Rails.root.join('node_modules/@gitlab/svgs/dist/icons.json')))['icons']
|
|
|
end
|
|
end
|
|
|
end |
|
end |