summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-09-03 16:38:35 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-09-03 16:38:35 -0400
commit4bd92e681e0a6d2a8d7e1ef44d9f248394833d09 (patch)
treedbd9edc770742f1404768232b6c4aa943eef467b
parente5d89c1084d1c1f29bfabe50718debf8867f760e (diff)
downloadgitlab-ce-4bd92e681e0a6d2a8d7e1ef44d9f248394833d09.tar.gz
Return early from markdown and gfm when text is empty
-rw-r--r--app/helpers/gitlab_markdown_helper.rb4
-rw-r--r--app/views/events/_event_issue.atom.haml3
-rw-r--r--app/views/events/_event_merge_request.atom.haml3
3 files changed, 6 insertions, 4 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index f2cab2840d4..803578f1911 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -45,6 +45,8 @@ module GitlabMarkdownHelper
end
def markdown(text, context = {})
+ return unless text.present?
+
context.merge!(
path: @path,
project: @project,
@@ -59,6 +61,8 @@ 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 = {})
+ return unless text.present?
+
options.merge!(
path: @path,
project: @project,
diff --git a/app/views/events/_event_issue.atom.haml b/app/views/events/_event_issue.atom.haml
index 4259f64c191..4e8d70e4e9d 100644
--- a/app/views/events/_event_issue.atom.haml
+++ b/app/views/events/_event_issue.atom.haml
@@ -1,3 +1,2 @@
%div{xmlns: "http://www.w3.org/1999/xhtml"}
- - if issue.description.present?
- = markdown(issue.description, xhtml: true, reference_only_path: false, project: issue.project)
+ = 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 e8ed13df783..db2b3550c49 100644
--- a/app/views/events/_event_merge_request.atom.haml
+++ b/app/views/events/_event_merge_request.atom.haml
@@ -1,3 +1,2 @@
%div{xmlns: "http://www.w3.org/1999/xhtml"}
- - if merge_request.description.present?
- = markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project)
+ = markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project)