diff options
author | David Eisner <david.eisner@oriel.oxon.org> | 2016-10-04 16:25:45 +0100 |
---|---|---|
committer | Airat Shigapov <contact@airatshigapov.com> | 2016-10-20 15:44:34 +0300 |
commit | b434b75fd0a5486325dabcf0a2edf652c959675b (patch) | |
tree | 028ff88b8f3ad5c1be7c2012a095325cf0e257cc | |
parent | eb074021b0bfeed139e098d06d45b562b98f6214 (diff) | |
download | gitlab-ce-b434b75fd0a5486325dabcf0a2edf652c959675b.tar.gz |
Ensure absolute URLs for single lines from Banzai for HipChat
"pipeline: :single_line" leaves the protocol/host part out of the URLs
and caches them that way. To avoid giving those out to HipChat, markdown
is always rendered with "pipeline: :email" first.
There must be a better way to do this, but I can't see how to avoid the
link caching.
-rw-r--r-- | app/models/project_services/hipchat_service.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index 9d52a1423b7..ce4a2a96015 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -125,12 +125,16 @@ class HipchatService < Service message end - def markdown(text, context = {}) + def markdown(text, options = {}) if text - context = ({ + context = { project: project, pipeline: :email - }).merge(context) + } + + Banzai.render(text, context) + + context.merge!(options) html = Banzai.render(text, context) html = Banzai.post_process(html, context) |