diff options
author | Airat Shigapov <contact@airatshigapov.com> | 2016-10-12 09:51:02 +0300 |
---|---|---|
committer | Airat Shigapov <contact@airatshigapov.com> | 2016-10-20 15:44:34 +0300 |
commit | 7b90680c2dd78d88d747fff545d69b1908ced7ae (patch) | |
tree | 181e55be896fcd210b417723378c425aa42e28d7 /app/models | |
parent | 32cf2e5f77c24c27782adc37d4635b06dfada060 (diff) | |
download | gitlab-ce-7b90680c2dd78d88d747fff545d69b1908ced7ae.tar.gz |
Use guard clause instead of if-else statement
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project_services/hipchat_service.rb | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index 8988a7b905e..e7a77070b9f 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -128,22 +128,21 @@ class HipchatService < Service end def markdown(text, options = {}) - if text - context = { - project: project, - pipeline: :email - } + return "" unless text - Banzai.render(text, context) + context = { + project: project, + pipeline: :email + } - context.merge!(options) + Banzai.render(text, context) - html = Banzai.render(text, context) - html = Banzai.post_process(html, context) - sanitize html, attributes: %w(href title alt) - else - "" - end + context.merge!(options) + + html = Banzai.render(text, context) + html = Banzai.post_process(html, context) + + sanitize html, attributes: %w(href title alt) end def create_issue_message(data) |