diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 4b35b0ac..135d002f 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -65,4 +65,9 @@ module CommitsHelper end end + def commit_to_html commit + if commit.model + escape_javascript(render 'commits/commit', commit: commit) + end + end end diff --git a/app/views/merge_requests/branch_from.js.haml b/app/views/merge_requests/branch_from.js.haml index 156b4f0d..0637fdcb 100644 --- a/app/views/merge_requests/branch_from.js.haml +++ b/app/views/merge_requests/branch_from.js.haml @@ -1,2 +1,2 @@ :plain - $(".mr_source_commit").html("#{escape_javascript(render 'commits/commit', commit: @commit)}"); + $(".mr_source_commit").html("#{commit_to_html(@commit)}"); diff --git a/app/views/merge_requests/branch_to.js.haml b/app/views/merge_requests/branch_to.js.haml index 8a201d42..974100d1 100644 --- a/app/views/merge_requests/branch_to.js.haml +++ b/app/views/merge_requests/branch_to.js.haml @@ -1,3 +1,2 @@ :plain - $(".mr_target_commit").html("#{escape_javascript(render 'commits/commit', commit: @commit)}"); - + $(".mr_target_commit").html("#{commit_to_html(@commit)}");