diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-05-14 13:05:33 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-05-14 13:05:33 +0200 |
commit | cd52cef1c0898230cb684ee294bd7a6c5b2f226a (patch) | |
tree | eb55e471d7d5e3d626f266b77f6931c708e145d4 /app | |
parent | 910794bae5a91479f41468ebc345db680a33b20e (diff) | |
download | gitlab-ce-cd52cef1c0898230cb684ee294bd7a6c5b2f226a.tar.gz |
Fix reference links in dashboard activity and ATOM feeds.dashboard-references
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/events_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 14 | ||||
-rw-r--r-- | app/views/events/_event_issue.atom.haml | 2 | ||||
-rw-r--r-- | app/views/events/_event_merge_request.atom.haml | 2 | ||||
-rw-r--r-- | app/views/events/_event_note.atom.haml | 2 | ||||
-rw-r--r-- | app/views/events/_event_push.atom.haml | 2 | ||||
-rw-r--r-- | app/views/events/event/_note.html.haml | 2 |
7 files changed, 15 insertions, 13 deletions
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 18c75a8726b..e55d729fa4f 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -168,8 +168,8 @@ module EventsHelper end end - def event_note(text) - text = first_line_in_markdown(text, 150) + def event_note(text, options = {}) + text = first_line_in_markdown(text, 150, options) sanitize(text, tags: %w(a img b pre code p span)) end diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index c309f890d96..846aded4bda 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -19,7 +19,7 @@ module GitlabMarkdownHelper escape_once(body) end - gfm_body = gfm(escaped_body, @project, html_options) + gfm_body = gfm(escaped_body, {}, html_options) gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match| "</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1 @@ -32,11 +32,13 @@ module GitlabMarkdownHelper unless @markdown && options == @options @options = options - # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch - rend = Redcarpet::Render::GitlabHTML.new(self, user_color_scheme_class, { + options.merge!( # Handled further down the line by Gitlab::Markdown::SanitizationFilter escape_html: false - }.merge(options)) + ) + + # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch + rend = Redcarpet::Render::GitlabHTML.new(self, user_color_scheme_class, options) # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use @markdown = Redcarpet::Markdown.new(rend, @@ -58,8 +60,8 @@ module GitlabMarkdownHelper # as Markdown. HTML tags in the parsed output are not counted toward the # +max_chars+ limit. If the length limit falls within a tag's contents, then # the tag contents are truncated without removing the closing tag. - def first_line_in_markdown(text, max_chars = nil) - md = markdown(text).strip + def first_line_in_markdown(text, max_chars = nil, options = {}) + md = markdown(text, options).strip truncate_visible(md, max_chars || md.length) if md.present? end diff --git a/app/views/events/_event_issue.atom.haml b/app/views/events/_event_issue.atom.haml index 0edb61ea246..4259f64c191 100644 --- a/app/views/events/_event_issue.atom.haml +++ b/app/views/events/_event_issue.atom.haml @@ -1,3 +1,3 @@ %div{xmlns: "http://www.w3.org/1999/xhtml"} - if issue.description.present? - = markdown(issue.description, xhtml: true) + = markdown(issue.description, xhtml: true, reference_only_path: false, project: issue.project) diff --git a/app/views/events/_event_merge_request.atom.haml b/app/views/events/_event_merge_request.atom.haml index 1a8b62abeab..e8ed13df783 100644 --- a/app/views/events/_event_merge_request.atom.haml +++ b/app/views/events/_event_merge_request.atom.haml @@ -1,3 +1,3 @@ %div{xmlns: "http://www.w3.org/1999/xhtml"} - if merge_request.description.present? - = markdown(merge_request.description, xhtml: true) + = markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project) diff --git a/app/views/events/_event_note.atom.haml b/app/views/events/_event_note.atom.haml index b49c331ccf2..cfbfba50202 100644 --- a/app/views/events/_event_note.atom.haml +++ b/app/views/events/_event_note.atom.haml @@ -1,2 +1,2 @@ %div{xmlns: "http://www.w3.org/1999/xhtml"} - = markdown(note.note, xhtml: true) + = markdown(note.note, xhtml: true, reference_only_path: false, project: note.project) diff --git a/app/views/events/_event_push.atom.haml b/app/views/events/_event_push.atom.haml index 5d14def8f75..42762e04b51 100644 --- a/app/views/events/_event_push.atom.haml +++ b/app/views/events/_event_push.atom.haml @@ -6,7 +6,7 @@ %i at = commit[:timestamp].to_time.to_s(:short) - %blockquote= markdown(escape_once(commit[:message]), xhtml: true) + %blockquote= markdown(escape_once(commit[:message]), xhtml: true, reference_only_path: false, project: note.project) - if event.commits_count > 15 %p %i diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index 4ef18c09060..07bec1697f5 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -14,7 +14,7 @@ .event-note .md %i.fa.fa-comment-o.event-note-icon - = event_note(event.target.note) + = event_note(event.target.note, project: event.project) - note = event.target - if note.attachment.url - if note.attachment.image? |