diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-28 12:46:09 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-02-28 12:46:09 +0300 |
commit | 94024cd6990102ad5d5386d84afcc09fe3007957 (patch) | |
tree | 525f9482707d7b7940d8bd4b6fe82281c4437840 | |
parent | f27536950fcc53bd4e4a74e323bcc88eb2ecb3a2 (diff) |
Jira: Make issue links title compact
Port of a community contribution from @glensc to upstream.
-rw-r--r-- | app/models/project_services/jira_service.rb | 5 | ||||
-rw-r--r-- | changelogs/unreleased/jira-link-mention-compact.yml | 5 | ||||
-rw-r--r-- | spec/models/project_services/jira_service_spec.rb | 3 | ||||
-rw-r--r-- | spec/services/system_note_service_spec.rb | 9 |
4 files changed, 16 insertions, 6 deletions
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 9066a0b7f1d..f7064d5aaea 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -215,7 +215,7 @@ class JiraService < IssueTrackerService end def add_issue_solved_comment(issue, commit_id, commit_url) - link_title = "GitLab: Solved by commit #{commit_id}." + link_title = "Solved by commit #{commit_id}." comment = "Issue solved with [#{commit_id}|#{commit_url}]." link_props = build_remote_link_props(url: commit_url, title: link_title, resolved: true) send_message(issue, comment, link_props) @@ -230,7 +230,7 @@ class JiraService < IssueTrackerService project_name = data[:project][:name] message = "[#{user_name}|#{user_url}] mentioned this issue in [a #{entity_name} of #{project_name}|#{entity_url}]:\n'#{entity_title.chomp}'" - link_title = "GitLab: Mentioned on #{entity_name} - #{entity_title}" + link_title = "#{entity_name.capitalize} - #{entity_title}" link_props = build_remote_link_props(url: entity_url, title: link_title) unless comment_exists?(issue, message) @@ -278,6 +278,7 @@ class JiraService < IssueTrackerService { GlobalID: 'GitLab', + relationship: 'mentioned on', object: { url: url, title: title, diff --git a/changelogs/unreleased/jira-link-mention-compact.yml b/changelogs/unreleased/jira-link-mention-compact.yml new file mode 100644 index 00000000000..f75f3ce183c --- /dev/null +++ b/changelogs/unreleased/jira-link-mention-compact.yml @@ -0,0 +1,5 @@ +--- +title: "Jira: make issue links title compact" +merge_request: 25609 +author: Elan Ruusamäe @glensc +type: changed diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 788b3179b01..5428fcb1271 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -177,9 +177,10 @@ describe JiraService do expect(WebMock).to have_requested(:post, @remote_link_url).with( body: hash_including( GlobalID: 'GitLab', + relationship: 'mentioned on', object: { url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/#{commit_id}", - title: "GitLab: Solved by commit #{commit_id}.", + title: "Solved by commit #{commit_id}.", icon: { title: 'GitLab', url16x16: favicon_path }, status: { resolved: true } } diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index 82544ab0413..b917de14b2e 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -807,9 +807,10 @@ describe SystemNoteService do expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with( body: hash_including( GlobalID: "GitLab", + relationship: 'mentioned on', object: { url: project_commit_url(project, commit), - title: "GitLab: Mentioned on commit - #{commit.title}", + title: "Commit - #{commit.title}", icon: { title: "GitLab", url16x16: favicon_path }, status: { resolved: false } } @@ -833,9 +834,10 @@ describe SystemNoteService do expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with( body: hash_including( GlobalID: "GitLab", + relationship: 'mentioned on', object: { url: project_issue_url(project, issue), - title: "GitLab: Mentioned on issue - #{issue.title}", + title: "Issue - #{issue.title}", icon: { title: "GitLab", url16x16: favicon_path }, status: { resolved: false } } @@ -859,9 +861,10 @@ describe SystemNoteService do expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with( body: hash_including( GlobalID: "GitLab", + relationship: 'mentioned on', object: { url: project_snippet_url(project, snippet), - title: "GitLab: Mentioned on snippet - #{snippet.title}", + title: "Snippet - #{snippet.title}", icon: { title: "GitLab", url16x16: favicon_path }, status: { resolved: false } } |