Commit 56529414 authored by Adam Hegyi's avatar Adam Hegyi

Fix VSA error with scoped labels

This change fixes the value_streams endpoint error when one of the
stages is a label based stage where the label is a scoped label.

Changelog: fixed
EE: true
parent 5d641b49
...@@ -57,7 +57,7 @@ module Analytics ...@@ -57,7 +57,7 @@ module Analytics
def html_description(event) def html_description(event)
options = {} options = {}
if event.label_based? if event.label_based?
label = event.label.present label = event.label.present(issuable_subject: event.label.subject)
options[:label_html] = render_label(label, link: '', small: true, tooltip: true) options[:label_html] = render_label(label, link: '', small: true, tooltip: true)
end end
......
...@@ -6,11 +6,12 @@ RSpec.describe Analytics::CycleAnalytics::StageEntity do ...@@ -6,11 +6,12 @@ RSpec.describe Analytics::CycleAnalytics::StageEntity do
subject(:entity_json) { described_class.new(Analytics::CycleAnalytics::StagePresenter.new(stage)).as_json } subject(:entity_json) { described_class.new(Analytics::CycleAnalytics::StagePresenter.new(stage)).as_json }
context 'when label based event is given' do context 'when label based event is given' do
let(:label) { create(:group_label, title: 'test label') } let(:label) { create(:group_label, title: 'test::label') }
let(:stage) { build(:cycle_analytics_group_stage, group: label.group, start_event_label: label, start_event_identifier: :merge_request_label_added, end_event_identifier: :merge_request_merged) } let(:stage) { build(:cycle_analytics_group_stage, group: label.group, start_event_label: label, start_event_identifier: :merge_request_label_added, end_event_identifier: :merge_request_merged) }
it 'includes the label reference in the description' do it 'includes the label reference in the description' do
expect(entity_json[:start_event_html_description]).to include(label.title) expect(entity_json[:start_event_html_description]).to include('test')
expect(entity_json[:start_event_html_description]).to include('label')
end end
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