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
b5d210c9
Commit
b5d210c9
authored
Sep 15, 2016
by
Airat Shigapov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render hipchat notification descriptions as HTML instead of raw markdown
parent
8e218edb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
16 deletions
+13
-16
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+3
-6
spec/models/project_services/hipchat_service_spec.rb
spec/models/project_services/hipchat_service_spec.rb
+10
-10
No files found.
app/models/project_services/hipchat_service.rb
View file @
b5d210c9
...
@@ -144,8 +144,7 @@ class HipchatService < Service
...
@@ -144,8 +144,7 @@ class HipchatService < Service
message
=
"
#{
user_name
}
#{
state
}
#{
issue_link
}
in
#{
project_link
}
: <b>
#{
title
}
</b>"
message
=
"
#{
user_name
}
#{
state
}
#{
issue_link
}
in
#{
project_link
}
: <b>
#{
title
}
</b>"
if
description
if
description
description
=
format_body
(
description
)
message
<<
format_body
(
Banzai
::
Filter
::
MarkdownFilter
.
renderer
.
render
(
description
))
message
<<
description
end
end
message
message
...
@@ -167,8 +166,7 @@ class HipchatService < Service
...
@@ -167,8 +166,7 @@ class HipchatService < Service
"
#{
project_link
}
: <b>
#{
title
}
</b>"
"
#{
project_link
}
: <b>
#{
title
}
</b>"
if
description
if
description
description
=
format_body
(
description
)
message
<<
format_body
(
Banzai
::
Filter
::
MarkdownFilter
.
renderer
.
render
(
description
))
message
<<
description
end
end
message
message
...
@@ -219,8 +217,7 @@ class HipchatService < Service
...
@@ -219,8 +217,7 @@ class HipchatService < Service
message
<<
title
message
<<
title
if
note
if
note
note
=
format_body
(
note
)
message
<<
format_body
(
Banzai
::
Filter
::
MarkdownFilter
.
renderer
.
render
(
note
))
message
<<
note
end
end
message
message
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
b5d210c9
...
@@ -117,7 +117,7 @@ describe HipchatService, models: true do
...
@@ -117,7 +117,7 @@ describe HipchatService, models: true do
end
end
context
'issue events'
do
context
'issue events'
do
let
(
:issue
)
{
create
(
:issue
,
title:
'Awesome issue'
,
description:
'
please
fix'
)
}
let
(
:issue
)
{
create
(
:issue
,
title:
'Awesome issue'
,
description:
'
**please**
fix'
)
}
let
(
:issue_service
)
{
Issues
::
CreateService
.
new
(
project
,
user
)
}
let
(
:issue_service
)
{
Issues
::
CreateService
.
new
(
project
,
user
)
}
let
(
:issues_sample_data
)
{
issue_service
.
hook_data
(
issue
,
'open'
)
}
let
(
:issues_sample_data
)
{
issue_service
.
hook_data
(
issue
,
'open'
)
}
...
@@ -135,12 +135,12 @@ describe HipchatService, models: true do
...
@@ -135,12 +135,12 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>issue #
#{
obj_attr
[
"iid"
]
}
</a> in "
\
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>issue #
#{
obj_attr
[
"iid"
]
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>Awesome issue</b>"
\
"<b>Awesome issue</b>"
\
"<pre>
please fix
</pre>"
)
"<pre>
<p><strong>please</strong> fix</p>
\n
</pre>"
)
end
end
end
end
context
'merge request events'
do
context
'merge request events'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
description:
'
please
fix'
,
title:
'Awesome merge request'
,
target_project:
project
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
description:
'
**please**
fix'
,
title:
'Awesome merge request'
,
target_project:
project
,
source_project:
project
)
}
let
(
:merge_service
)
{
MergeRequests
::
CreateService
.
new
(
project
,
user
)
}
let
(
:merge_service
)
{
MergeRequests
::
CreateService
.
new
(
project
,
user
)
}
let
(
:merge_sample_data
)
{
merge_service
.
hook_data
(
merge_request
,
'open'
)
}
let
(
:merge_sample_data
)
{
merge_service
.
hook_data
(
merge_request
,
'open'
)
}
...
@@ -159,7 +159,7 @@ describe HipchatService, models: true do
...
@@ -159,7 +159,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>merge request !
#{
obj_attr
[
"iid"
]
}
</a> in "
\
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>merge request !
#{
obj_attr
[
"iid"
]
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>Awesome merge request</b>"
\
"<b>Awesome merge request</b>"
\
"<pre>
please fix
</pre>"
)
"<pre>
<p><strong>please</strong> fix</p>
\n
</pre>"
)
end
end
end
end
...
@@ -190,7 +190,7 @@ describe HipchatService, models: true do
...
@@ -190,7 +190,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>commit
#{
commit_id
}
</a> in "
\
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>commit
#{
commit_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"
#{
title
}
"
\
"
#{
title
}
"
\
"<pre>
a comment on a commit
</pre>"
)
"<pre>
<p>a comment on a commit</p>
\n
</pre>"
)
end
end
end
end
...
@@ -203,7 +203,7 @@ describe HipchatService, models: true do
...
@@ -203,7 +203,7 @@ describe HipchatService, models: true do
let
(
:merge_request_note
)
do
let
(
:merge_request_note
)
do
create
(
:note_on_merge_request
,
noteable:
merge_request
,
create
(
:note_on_merge_request
,
noteable:
merge_request
,
project:
project
,
project:
project
,
note:
"merge request
note
"
)
note:
"merge request
**note**
"
)
end
end
it
"calls Hipchat API for merge request comment events"
do
it
"calls Hipchat API for merge request comment events"
do
...
@@ -222,7 +222,7 @@ describe HipchatService, models: true do
...
@@ -222,7 +222,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>merge request !
#{
merge_id
}
</a> in "
\
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>merge request !
#{
merge_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>
#{
title
}
</b>"
\
"<b>
#{
title
}
</b>"
\
"<pre>
merge request note
</pre>"
)
"<pre>
<p>merge request <strong>note</strong></p>
\n
</pre>"
)
end
end
end
end
...
@@ -230,7 +230,7 @@ describe HipchatService, models: true do
...
@@ -230,7 +230,7 @@ describe HipchatService, models: true do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue_note
)
do
let
(
:issue_note
)
do
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
,
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
,
note:
"issue
note
"
)
note:
"issue
**note**
"
)
end
end
it
"calls Hipchat API for issue comment events"
do
it
"calls Hipchat API for issue comment events"
do
...
@@ -247,7 +247,7 @@ describe HipchatService, models: true do
...
@@ -247,7 +247,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>issue #
#{
issue_id
}
</a> in "
\
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>issue #
#{
issue_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>
#{
title
}
</b>"
\
"<b>
#{
title
}
</b>"
\
"<pre>
issue note
</pre>"
)
"<pre>
<p>issue <strong>note</strong></p>
\n
</pre>"
)
end
end
end
end
...
@@ -275,7 +275,7 @@ describe HipchatService, models: true do
...
@@ -275,7 +275,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>snippet #
#{
snippet_id
}
</a> in "
\
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>snippet #
#{
snippet_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>
#{
title
}
</b>"
\
"<b>
#{
title
}
</b>"
\
"<pre>
snippet note
</pre>"
)
"<pre>
<p>snippet note</p>
\n
</pre>"
)
end
end
end
end
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