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
Jérome Perrin
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
message
=
"
#{
user_name
}
#{
state
}
#{
issue_link
}
in
#{
project_link
}
: <b>
#{
title
}
</b>"
if
description
description
=
format_body
(
description
)
message
<<
description
message
<<
format_body
(
Banzai
::
Filter
::
MarkdownFilter
.
renderer
.
render
(
description
))
end
message
...
...
@@ -167,8 +166,7 @@ class HipchatService < Service
"
#{
project_link
}
: <b>
#{
title
}
</b>"
if
description
description
=
format_body
(
description
)
message
<<
description
message
<<
format_body
(
Banzai
::
Filter
::
MarkdownFilter
.
renderer
.
render
(
description
))
end
message
...
...
@@ -219,8 +217,7 @@ class HipchatService < Service
message
<<
title
if
note
note
=
format_body
(
note
)
message
<<
note
message
<<
format_body
(
Banzai
::
Filter
::
MarkdownFilter
.
renderer
.
render
(
note
))
end
message
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
b5d210c9
...
...
@@ -117,7 +117,7 @@ describe HipchatService, models: true do
end
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
(
:issues_sample_data
)
{
issue_service
.
hook_data
(
issue
,
'open'
)
}
...
...
@@ -135,12 +135,12 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>issue #
#{
obj_attr
[
"iid"
]
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>Awesome issue</b>"
\
"<pre>
please fix
</pre>"
)
"<pre>
<p><strong>please</strong> fix</p>
\n
</pre>"
)
end
end
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_sample_data
)
{
merge_service
.
hook_data
(
merge_request
,
'open'
)
}
...
...
@@ -159,7 +159,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>merge request !
#{
obj_attr
[
"iid"
]
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>Awesome merge request</b>"
\
"<pre>
please fix
</pre>"
)
"<pre>
<p><strong>please</strong> fix</p>
\n
</pre>"
)
end
end
...
...
@@ -190,7 +190,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>commit
#{
commit_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"
#{
title
}
"
\
"<pre>
a comment on a commit
</pre>"
)
"<pre>
<p>a comment on a commit</p>
\n
</pre>"
)
end
end
...
...
@@ -203,7 +203,7 @@ describe HipchatService, models: true do
let
(
:merge_request_note
)
do
create
(
:note_on_merge_request
,
noteable:
merge_request
,
project:
project
,
note:
"merge request
note
"
)
note:
"merge request
**note**
"
)
end
it
"calls Hipchat API for merge request comment events"
do
...
...
@@ -222,7 +222,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>merge request !
#{
merge_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>
#{
title
}
</b>"
\
"<pre>
merge request note
</pre>"
)
"<pre>
<p>merge request <strong>note</strong></p>
\n
</pre>"
)
end
end
...
...
@@ -230,7 +230,7 @@ describe HipchatService, models: true do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue_note
)
do
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
,
note:
"issue
note
"
)
note:
"issue
**note**
"
)
end
it
"calls Hipchat API for issue comment events"
do
...
...
@@ -247,7 +247,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>issue #
#{
issue_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>
#{
title
}
</b>"
\
"<pre>
issue note
</pre>"
)
"<pre>
<p>issue <strong>note</strong></p>
\n
</pre>"
)
end
end
...
...
@@ -275,7 +275,7 @@ describe HipchatService, models: true do
"<a href=
\"
#{
obj_attr
[
:url
]
}
\"
>snippet #
#{
snippet_id
}
</a> in "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>: "
\
"<b>
#{
title
}
</b>"
\
"<pre>
snippet note
</pre>"
)
"<pre>
<p>snippet note</p>
\n
</pre>"
)
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