Commit e64b1e52 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Check if GFM rewriters need rewrite internally

parent d08de5ed
...@@ -69,7 +69,7 @@ module Issues ...@@ -69,7 +69,7 @@ module Issues
rewriters.inject(content) do |text, klass| rewriters.inject(content) do |text, klass|
rewriter = klass.new(text, @old_project, @current_user) rewriter = klass.new(text, @old_project, @current_user)
rewriter.needs_rewrite? ? rewriter.rewrite(@new_project) : text rewriter.rewrite(@new_project)
end end
end end
......
...@@ -38,6 +38,8 @@ module Gitlab ...@@ -38,6 +38,8 @@ module Gitlab
end end
def rewrite(target_project) def rewrite(target_project)
return @text unless needs_rewrite?
@text.gsub(@pattern) do |reference| @text.gsub(@pattern) do |reference|
unfold_reference(reference, Regexp.last_match, target_project) unfold_reference(reference, Regexp.last_match, target_project)
end end
......
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
end end
def rewrite(target_project) def rewrite(target_project)
return unless @text return @text unless needs_rewrite?
new_uploader = file_uploader(target_project) new_uploader = file_uploader(target_project)
@text.gsub(@pattern) do |markdown| @text.gsub(@pattern) do |markdown|
......
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