From 3b39b648d2f0545f9d3dbd1680f8e9e977893792 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 18 Sep 2015 11:05:27 -0700 Subject: Fix Markdown links not showing up in dashboard activity feed Closes #2586 --- CHANGELOG | 1 + app/helpers/gitlab_markdown_helper.rb | 4 ++-- spec/helpers/gitlab_markdown_helper_spec.rb | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a1b17e58156..cb3794f7cb6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.0.0 (unreleased) + - Fix Markdown links not showing up in dashboard activity feed (Stan Hu) - Fix HTML link that was improperly escaped in new user e-mail (Stan Hu) - Fix broken sort in merge request API (Stan Hu) - Bump rouge to 1.10.1 to remove warning noise and fix other syntax highlighting bugs (Stan Hu) diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 1ebfd92f119..78bf25f55e7 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -45,7 +45,7 @@ module GitlabMarkdownHelper end def markdown(text, context = {}) - context.merge!( + context.reverse_merge!( current_user: current_user, path: @path, project: @project, @@ -59,7 +59,7 @@ module GitlabMarkdownHelper # TODO (rspeicher): Remove all usages of this helper and just call `markdown` # with a custom pipeline depending on the content being rendered def gfm(text, options = {}) - options.merge!( + options.reverse_merge!( current_user: current_user, path: @path, project: @project, diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 5639b3db913..b8101ae77ec 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -38,6 +38,17 @@ describe GitlabMarkdownHelper do expect(markdown(actual)).to match(expected) end end + + describe "override default project" do + let(:actual) { issue.to_reference } + let(:second_project) { create(:project) } + let(:second_issue) { create(:issue, project: second_project) } + + it 'should link to the issue' do + expected = namespace_project_issue_path(second_project.namespace, second_project, second_issue) + expect(markdown(actual, project: second_project)).to match(expected) + end + end end describe '#link_to_gfm' do -- cgit v1.2.1