Use guard clause instead of if-else statement
This commit is contained in:
parent
32cf2e5f77
commit
7b90680c2d
1 changed files with 12 additions and 13 deletions
|
@ -128,22 +128,21 @@ class HipchatService < Service
|
||||||
end
|
end
|
||||||
|
|
||||||
def markdown(text, options = {})
|
def markdown(text, options = {})
|
||||||
if text
|
return "" unless text
|
||||||
context = {
|
|
||||||
project: project,
|
|
||||||
pipeline: :email
|
|
||||||
}
|
|
||||||
|
|
||||||
Banzai.render(text, context)
|
context = {
|
||||||
|
project: project,
|
||||||
|
pipeline: :email
|
||||||
|
}
|
||||||
|
|
||||||
context.merge!(options)
|
Banzai.render(text, context)
|
||||||
|
|
||||||
html = Banzai.render(text, context)
|
context.merge!(options)
|
||||||
html = Banzai.post_process(html, context)
|
|
||||||
sanitize html, attributes: %w(href title alt)
|
html = Banzai.render(text, context)
|
||||||
else
|
html = Banzai.post_process(html, context)
|
||||||
""
|
|
||||||
end
|
sanitize html, attributes: %w(href title alt)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_issue_message(data)
|
def create_issue_message(data)
|
||||||
|
|
Loading…
Reference in a new issue