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
7706b3a4
Commit
7706b3a4
authored
Apr 13, 2018
by
Alexis Reigel
Committed by
Alexis Reigel
Jun 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use Gitlab::Favicon for jira service
parent
9151aed7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+1
-1
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+17
-1
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+5
-3
No files found.
app/models/project_services/jira_service.rb
View file @
7706b3a4
...
@@ -265,7 +265,7 @@ class JiraService < IssueTrackerService
...
@@ -265,7 +265,7 @@ class JiraService < IssueTrackerService
title:
title
,
title:
title
,
status:
status
,
status:
status
,
icon:
{
icon:
{
title:
'GitLab'
,
url16x16:
asset_url
(
'favicon.png'
,
host:
gitlab_config
.
url
)
title:
'GitLab'
,
url16x16:
asset_url
(
Gitlab
::
Favicon
.
main
,
host:
gitlab_config
.
url
)
}
}
}
}
}
}
...
...
spec/models/project_services/jira_service_spec.rb
View file @
7706b3a4
...
@@ -164,6 +164,8 @@ describe JiraService do
...
@@ -164,6 +164,8 @@ describe JiraService do
it
"creates Remote Link reference in JIRA for comment"
do
it
"creates Remote Link reference in JIRA for comment"
do
@jira_service
.
close_issue
(
merge_request
,
ExternalIssue
.
new
(
"JIRA-123"
,
project
))
@jira_service
.
close_issue
(
merge_request
,
ExternalIssue
.
new
(
"JIRA-123"
,
project
))
favicon_path
=
"http://localhost/assets/
#{
Rails
.
application
.
assets
.
find_asset
(
'favicon.png'
).
digest_path
}
"
# Creates comment
# Creates comment
expect
(
WebMock
).
to
have_requested
(
:post
,
@comment_url
)
expect
(
WebMock
).
to
have_requested
(
:post
,
@comment_url
)
# Creates Remote Link in JIRA issue fields
# Creates Remote Link in JIRA issue fields
...
@@ -173,7 +175,7 @@ describe JiraService do
...
@@ -173,7 +175,7 @@ describe JiraService do
object:
{
object:
{
url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
full_path
}
/commit/
#{
merge_request
.
diff_head_sha
}
"
,
url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
full_path
}
/commit/
#{
merge_request
.
diff_head_sha
}
"
,
title:
"GitLab: Solved by commit
#{
merge_request
.
diff_head_sha
}
."
,
title:
"GitLab: Solved by commit
#{
merge_request
.
diff_head_sha
}
."
,
icon:
{
title:
"GitLab"
,
url16x16:
"http://localhost/favicon.png"
},
icon:
{
title:
"GitLab"
,
url16x16:
favicon_path
},
status:
{
resolved:
true
}
status:
{
resolved:
true
}
}
}
)
)
...
@@ -464,4 +466,18 @@ describe JiraService do
...
@@ -464,4 +466,18 @@ describe JiraService do
end
end
end
end
end
end
describe
'favicon urls'
,
:request_store
do
it
'includes the standard favicon'
do
props
=
described_class
.
new
.
send
(
:build_remote_link_props
,
url:
'http://example.com'
,
title:
'title'
)
expect
(
props
[
:object
][
:icon
][
:url16x16
]).
to
match
%r{^http://localhost/assets/favicon(?:-
\h
+).png$}
end
it
'includes returns the custom favicon'
do
create
:appearance
,
favicon:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
props
=
described_class
.
new
.
send
(
:build_remote_link_props
,
url:
'http://example.com'
,
title:
'title'
)
expect
(
props
[
:object
][
:icon
][
:url16x16
]).
to
match
%r{^http://localhost/uploads/-/system/appearance/favicon/
\d
+/favicon_main_dk.png$}
end
end
end
end
spec/services/system_note_service_spec.rb
View file @
7706b3a4
...
@@ -769,6 +769,8 @@ describe SystemNoteService do
...
@@ -769,6 +769,8 @@ describe SystemNoteService do
end
end
describe
"new reference"
do
describe
"new reference"
do
let
(
:favicon_path
)
{
"http://localhost/assets/
#{
Rails
.
application
.
assets
.
find_asset
(
'favicon.png'
).
digest_path
}
"
}
before
do
before
do
allow
(
JIRA
::
Resource
::
Remotelink
).
to
receive
(
:all
).
and_return
([])
allow
(
JIRA
::
Resource
::
Remotelink
).
to
receive
(
:all
).
and_return
([])
end
end
...
@@ -789,7 +791,7 @@ describe SystemNoteService do
...
@@ -789,7 +791,7 @@ describe SystemNoteService do
object:
{
object:
{
url:
project_commit_url
(
project
,
commit
),
url:
project_commit_url
(
project
,
commit
),
title:
"GitLab: Mentioned on commit -
#{
commit
.
title
}
"
,
title:
"GitLab: Mentioned on commit -
#{
commit
.
title
}
"
,
icon:
{
title:
"GitLab"
,
url16x16:
"http://localhost/favicon.png"
},
icon:
{
title:
"GitLab"
,
url16x16:
favicon_path
},
status:
{
resolved:
false
}
status:
{
resolved:
false
}
}
}
)
)
...
@@ -815,7 +817,7 @@ describe SystemNoteService do
...
@@ -815,7 +817,7 @@ describe SystemNoteService do
object:
{
object:
{
url:
project_issue_url
(
project
,
issue
),
url:
project_issue_url
(
project
,
issue
),
title:
"GitLab: Mentioned on issue -
#{
issue
.
title
}
"
,
title:
"GitLab: Mentioned on issue -
#{
issue
.
title
}
"
,
icon:
{
title:
"GitLab"
,
url16x16:
"http://localhost/favicon.png"
},
icon:
{
title:
"GitLab"
,
url16x16:
favicon_path
},
status:
{
resolved:
false
}
status:
{
resolved:
false
}
}
}
)
)
...
@@ -841,7 +843,7 @@ describe SystemNoteService do
...
@@ -841,7 +843,7 @@ describe SystemNoteService do
object:
{
object:
{
url:
project_snippet_url
(
project
,
snippet
),
url:
project_snippet_url
(
project
,
snippet
),
title:
"GitLab: Mentioned on snippet -
#{
snippet
.
title
}
"
,
title:
"GitLab: Mentioned on snippet -
#{
snippet
.
title
}
"
,
icon:
{
title:
"GitLab"
,
url16x16:
"http://localhost/favicon.png"
},
icon:
{
title:
"GitLab"
,
url16x16:
favicon_path
},
status:
{
resolved:
false
}
status:
{
resolved:
false
}
}
}
)
)
...
...
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