use Gitlab::Favicon for jira service
This commit is contained in:
parent
9151aed773
commit
7706b3a471
3 changed files with 23 additions and 5 deletions
|
@ -265,7 +265,7 @@ class JiraService < IssueTrackerService
|
|||
title: title,
|
||||
status: status,
|
||||
icon: {
|
||||
title: 'GitLab', url16x16: asset_url('favicon.png', host: gitlab_config.url)
|
||||
title: 'GitLab', url16x16: asset_url(Gitlab::Favicon.main, host: gitlab_config.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,6 +164,8 @@ describe JiraService do
|
|||
it "creates Remote Link reference in JIRA for comment" do
|
||||
@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
|
||||
expect(WebMock).to have_requested(:post, @comment_url)
|
||||
# Creates Remote Link in JIRA issue fields
|
||||
|
@ -173,7 +175,7 @@ describe JiraService do
|
|||
object: {
|
||||
url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/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 }
|
||||
}
|
||||
)
|
||||
|
@ -464,4 +466,18 @@ describe JiraService do
|
|||
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
|
||||
|
|
|
@ -769,6 +769,8 @@ describe SystemNoteService do
|
|||
end
|
||||
|
||||
describe "new reference" do
|
||||
let(:favicon_path) { "http://localhost/assets/#{Rails.application.assets.find_asset('favicon.png').digest_path}" }
|
||||
|
||||
before do
|
||||
allow(JIRA::Resource::Remotelink).to receive(:all).and_return([])
|
||||
end
|
||||
|
@ -789,7 +791,7 @@ describe SystemNoteService do
|
|||
object: {
|
||||
url: project_commit_url(project, commit),
|
||||
title: "GitLab: Mentioned on commit - #{commit.title}",
|
||||
icon: { title: "GitLab", url16x16: "http://localhost/favicon.png" },
|
||||
icon: { title: "GitLab", url16x16: favicon_path },
|
||||
status: { resolved: false }
|
||||
}
|
||||
)
|
||||
|
@ -815,7 +817,7 @@ describe SystemNoteService do
|
|||
object: {
|
||||
url: project_issue_url(project, issue),
|
||||
title: "GitLab: Mentioned on issue - #{issue.title}",
|
||||
icon: { title: "GitLab", url16x16: "http://localhost/favicon.png" },
|
||||
icon: { title: "GitLab", url16x16: favicon_path },
|
||||
status: { resolved: false }
|
||||
}
|
||||
)
|
||||
|
@ -841,7 +843,7 @@ describe SystemNoteService do
|
|||
object: {
|
||||
url: project_snippet_url(project, snippet),
|
||||
title: "GitLab: Mentioned on snippet - #{snippet.title}",
|
||||
icon: { title: "GitLab", url16x16: "http://localhost/favicon.png" },
|
||||
icon: { title: "GitLab", url16x16: favicon_path },
|
||||
status: { resolved: false }
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue