Commit b1552831 authored by Felipe Artur's avatar Felipe Artur Committed by Nick Thomas

Resolve: Epic labels in system notes point to the epic itself

Fix label notes on epics with empty links
parent 4b55148b
...@@ -15,7 +15,7 @@ module CacheMarkdownField ...@@ -15,7 +15,7 @@ module CacheMarkdownField
# Increment this number every time the renderer changes its output # Increment this number every time the renderer changes its output
CACHE_COMMONMARK_VERSION_START = 10 CACHE_COMMONMARK_VERSION_START = 10
CACHE_COMMONMARK_VERSION = 15 CACHE_COMMONMARK_VERSION = 16
# changes to these attributes cause the cache to be invalidates # changes to these attributes cause the cache to be invalidates
INVALIDATED_BY = %w[author project].freeze INVALIDATED_BY = %w[author project].freeze
......
...@@ -19,5 +19,10 @@ module EE ...@@ -19,5 +19,10 @@ module EE
def issuable def issuable
epic || super epic || super
end end
override :banzai_render_context
def banzai_render_context(field)
epic ? super.merge(label_url_method: :group_epics_url) : super
end
end end
end end
---
title: 'Resolve: Epic labels in system notes point to the epic itself'
merge_request: 11234
author:
type: fixed
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe LabelNote do describe LabelNote do
include Gitlab::Routing.url_helpers
set(:group) { create(:group) } set(:group) { create(:group) }
set(:user) { create(:user) } set(:user) { create(:user) }
set(:label) { create(:group_label, group: group) } set(:label) { create(:group_label, group: group) }
...@@ -14,5 +16,14 @@ describe LabelNote do ...@@ -14,5 +16,14 @@ describe LabelNote do
let(:project) { nil } let(:project) { nil }
it_behaves_like 'label note created from events' it_behaves_like 'label note created from events'
it 'includes a link to the list of epics filtered by the label' do
resource_key = resource.class.name.underscore.to_s
events = [build(:resource_label_event, label: label, resource_key => resource)]
note = described_class.from_events(events)
expect(note.note_html).to include(group_epics_path(group, label_name: label.title))
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