Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
189e3b57
Commit
189e3b57
authored
Jan 06, 2016
by
David Eisner
Committed by
Rémy Coutable
Jul 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HipChat notification color overridden by build status
parent
e9946f19
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+11
-3
No files found.
app/models/project_services/hipchat_service.rb
View file @
189e3b57
...
@@ -46,7 +46,7 @@ class HipchatService < Service
...
@@ -46,7 +46,7 @@ class HipchatService < Service
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
message
=
create_message
(
data
)
message
=
create_message
(
data
)
return
unless
message
.
present?
return
unless
message
.
present?
gate
[
room
].
send
(
'GitLab'
,
message
,
message_options
)
gate
[
room
].
send
(
'GitLab'
,
message
,
message_options
(
data
)
)
end
end
def
test
(
data
)
def
test
(
data
)
...
@@ -67,8 +67,8 @@ class HipchatService < Service
...
@@ -67,8 +67,8 @@ class HipchatService < Service
@gate
||=
HipChat
::
Client
.
new
(
token
,
options
)
@gate
||=
HipChat
::
Client
.
new
(
token
,
options
)
end
end
def
message_options
def
message_options
(
data
)
{
notify:
notify
.
present?
&&
notify
==
'1'
,
color:
color
||
'yellow'
}
{
notify:
notify
.
present?
&&
notify
==
'1'
,
color:
build_status_color
(
data
)
||
color
||
'yellow'
}
end
end
def
create_message
(
data
)
def
create_message
(
data
)
...
@@ -240,6 +240,14 @@ class HipchatService < Service
...
@@ -240,6 +240,14 @@ 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
build_status_color
(
data
)
if
data
[
:commit
][
:status
]
==
'success'
'green'
else
'red'
end
if
data
[
:object_kind
]
==
'build'
end
def
project_name
def
project_name
project
.
name_with_namespace
.
gsub
(
/\s/
,
''
)
project
.
name_with_namespace
.
gsub
(
/\s/
,
''
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment