diff options
author | David Eisner <david.eisner@oriel.oxon.org> | 2016-10-04 16:25:45 +0100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2016-10-21 08:43:35 +1100 |
commit | 73f13526d6ef3da1289074e2503bf2764b41b137 (patch) | |
tree | ac3c4be8df567ab54dd97ea318ccb7f0c3641303 /app | |
parent | 59b2770a035489db9995b8638792ed5c92242035 (diff) | |
download | gitlab-ce-73f13526d6ef3da1289074e2503bf2764b41b137.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.
Diffstat (limited to 'app')
-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) |