From d9c20cf5a63dd1f337e408d26eb3f68750dadb75 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 31 Oct 2012 14:29:42 +0200 Subject: [PATCH] Fix 404 errors on Merge Request -> new --- app/helpers/commits_helper.rb | 5 +++++ app/views/merge_requests/branch_from.js.haml | 2 +- app/views/merge_requests/branch_to.js.haml | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) 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)}");