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
Boxiang Sun
gitlab-ce
Commits
8e0c8684
Commit
8e0c8684
authored
Oct 04, 2016
by
David Eisner
Committed by
Airat Shigapov
Oct 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also render commit titles in HipChat notifications
parent
3d034c15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+8
-4
No files found.
app/models/project_services/hipchat_service.rb
View file @
8e0c8684
...
...
@@ -88,6 +88,10 @@ class HipchatService < Service
end
end
def
render_line
(
text
)
Banzai
.
render
(
text
.
lines
.
first
.
chomp
,
project:
project
,
pipeline: :single_line
)
if
text
end
def
create_push_message
(
push
)
ref_type
=
Gitlab
::
Git
.
tag_ref?
(
push
[
:ref
])
?
'tag'
:
'branch'
ref
=
Gitlab
::
Git
.
ref_name
(
push
[
:ref
])
...
...
@@ -110,7 +114,7 @@ class HipchatService < Service
message
<<
"(<a href=
\"
#{
project
.
web_url
}
/compare/
#{
before
}
...
#{
after
}
\"
>Compare changes</a>)"
push
[
:commits
].
take
(
MAX_COMMITS
).
each
do
|
commit
|
message
<<
"<br /> -
#{
commit
[
:message
].
lines
.
first
}
(<a href=
\"
#{
commit
[
:url
]
}
\"
>
#{
commit
[
:id
][
0
..
5
]
}
</a>)"
message
<<
"<br /> -
#{
render_line
(
commit
[
:message
])
}
(<a href=
\"
#{
commit
[
:url
]
}
\"
>
#{
commit
[
:id
][
0
..
5
]
}
</a>)"
end
if
push
[
:commits
].
count
>
MAX_COMMITS
...
...
@@ -126,7 +130,7 @@ class HipchatService < Service
obj_attr
=
data
[
:object_attributes
]
obj_attr
=
HashWithIndifferentAccess
.
new
(
obj_attr
)
title
=
obj_attr
[
:title
]
title
=
render_line
(
obj_attr
[
:title
])
state
=
obj_attr
[
:state
]
issue_iid
=
obj_attr
[
:iid
]
issue_url
=
obj_attr
[
:url
]
...
...
@@ -150,7 +154,7 @@ class HipchatService < Service
merge_request_id
=
obj_attr
[
:iid
]
state
=
obj_attr
[
:state
]
description
=
obj_attr
[
:description
]
title
=
obj_attr
[
:title
]
title
=
render_line
(
obj_attr
[
:title
])
merge_request_url
=
"
#{
project_url
}
/merge_requests/
#{
merge_request_id
}
"
merge_request_link
=
"<a href=
\"
#{
merge_request_url
}
\"
>merge request !
#{
merge_request_id
}
</a>"
...
...
@@ -165,7 +169,7 @@ class HipchatService < Service
end
def
format_title
(
title
)
"<b>
"
+
title
.
lines
.
first
.
chomp
+
"
</b>"
"<b>
#{
render_line
(
title
)
}
</b>"
end
def
create_note_message
(
data
)
...
...
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