Commit ff0c1d9b authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix incorrect MR popovers

Fixes a bug where cross-project MR references were showing incorrect
popovers
parent 7fa6147d
...@@ -58,7 +58,7 @@ module Banzai ...@@ -58,7 +58,7 @@ module Banzai
end end
def data_attributes_for(text, parent, object, **data) def data_attributes_for(text, parent, object, **data)
super.merge(project_path: current_parent_path, iid: object.iid, mr_title: object.title) super.merge(project_path: parent.full_path, iid: object.iid, mr_title: object.title)
end end
private private
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module MarkdownCache module MarkdownCache
# Increment this number every time the renderer changes its output # Increment this number every time the renderer changes its output
CACHE_COMMONMARK_VERSION = 27 CACHE_COMMONMARK_VERSION = 28
CACHE_COMMONMARK_VERSION_START = 10 CACHE_COMMONMARK_VERSION_START = 10
BaseError = Class.new(StandardError) BaseError = Class.new(StandardError)
......
...@@ -142,6 +142,17 @@ RSpec.describe Banzai::Filter::References::MergeRequestReferenceFilter do ...@@ -142,6 +142,17 @@ RSpec.describe Banzai::Filter::References::MergeRequestReferenceFilter do
expect(doc.text).to eq("Merge (#{reference}.)") expect(doc.text).to eq("Merge (#{reference}.)")
end end
it 'has correct data attributes' do
doc = reference_filter("Merge (#{reference}.)")
link = doc.css('a').first
expect(link.attr('data-project')).to eq project2.id.to_s
expect(link.attr('data-project-path')).to eq project2.full_path
expect(link.attr('data-iid')).to eq merge.iid.to_s
expect(link.attr('data-mr-title')).to eq merge.title
end
it 'ignores invalid merge IDs on the referenced project' do it 'ignores invalid merge IDs on the referenced project' do
exp = act = "Merge #{invalidate_reference(reference)}" exp = act = "Merge #{invalidate_reference(reference)}"
......
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