Commit 386478d8 authored by Rémy Coutable's avatar Rémy Coutable

Move color-logic into HipchatService#HipchatService

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 255162e1
...@@ -68,7 +68,7 @@ class HipchatService < Service ...@@ -68,7 +68,7 @@ class HipchatService < Service
end end
def message_options(data = nil) def message_options(data = nil)
{ notify: notify.present? && notify == '1', color: build_status_color(data) || color || 'yellow' } { notify: notify.present? && notify == '1', color: message_color(data) }
end end
def create_message(data) def create_message(data)
...@@ -240,6 +240,10 @@ class HipchatService < Service ...@@ -240,6 +240,10 @@ class HipchatService < Service
"#{project_link}: Commit #{commit_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status(status)} in #{duration} second(s)" "#{project_link}: Commit #{commit_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status(status)} in #{duration} second(s)"
end end
def message_color(data)
build_status_color(data) || color || 'yellow'
end
def build_status_color(data) def build_status_color(data)
return unless data && data[:object_kind] == 'build' return unless data && data[:object_kind] == 'build'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment