Move color-logic into HipchatService#HipchatService

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2016-07-27 11:29:05 +02:00
parent 255162e194
commit 386478d800
No known key found for this signature in database
GPG Key ID: 46DF07E5CD9E96AB
1 changed files with 5 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class HipchatService < Service
end
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
def create_message(data)
@ -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)"
end
def message_color(data)
build_status_color(data) || color || 'yellow'
end
def build_status_color(data)
return unless data && data[:object_kind] == 'build'