Check if GFM rewriters need rewrite internally

This commit is contained in:
Grzegorz Bizon 2016-03-30 10:42:39 +02:00
parent d08de5ed0e
commit e64b1e52a2
3 changed files with 4 additions and 2 deletions

View file

@ -69,7 +69,7 @@ module Issues
rewriters.inject(content) do |text, klass|
rewriter = klass.new(text, @old_project, @current_user)
rewriter.needs_rewrite? ? rewriter.rewrite(@new_project) : text
rewriter.rewrite(@new_project)
end
end

View file

@ -38,6 +38,8 @@ module Gitlab
end
def rewrite(target_project)
return @text unless needs_rewrite?
@text.gsub(@pattern) do |reference|
unfold_reference(reference, Regexp.last_match, target_project)
end

View file

@ -15,7 +15,7 @@ module Gitlab
end
def rewrite(target_project)
return unless @text
return @text unless needs_rewrite?
new_uploader = file_uploader(target_project)
@text.gsub(@pattern) do |markdown|