Commit 94024cd6 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by Sean McGivern
Browse files

Jira: Make issue links title compact

Port of a community contribution from @glensc to upstream.
parent f2753695
...@@ -215,7 +215,7 @@ def transition_issue(issue) ...@@ -215,7 +215,7 @@ def transition_issue(issue)
end end
def add_issue_solved_comment(issue, commit_id, commit_url) 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}]." comment = "Issue solved with [#{commit_id}|#{commit_url}]."
link_props = build_remote_link_props(url: commit_url, title: link_title, resolved: true) link_props = build_remote_link_props(url: commit_url, title: link_title, resolved: true)
send_message(issue, comment, link_props) send_message(issue, comment, link_props)
...@@ -230,7 +230,7 @@ def add_comment(data, issue) ...@@ -230,7 +230,7 @@ def add_comment(data, issue)
project_name = data[:project][:name] 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}'" 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) link_props = build_remote_link_props(url: entity_url, title: link_title)
unless comment_exists?(issue, message) unless comment_exists?(issue, message)
...@@ -278,6 +278,7 @@ def build_remote_link_props(url:, title:, resolved: false) ...@@ -278,6 +278,7 @@ def build_remote_link_props(url:, title:, resolved: false)
{ {
GlobalID: 'GitLab', GlobalID: 'GitLab',
relationship: 'mentioned on',
object: { object: {
url: url, url: url,
title: title, title: title,
......
---
title: "Jira: make issue links title compact"
merge_request: 25609
author: Elan Ruusamäe @glensc
type: changed
...@@ -177,9 +177,10 @@ ...@@ -177,9 +177,10 @@
expect(WebMock).to have_requested(:post, @remote_link_url).with( expect(WebMock).to have_requested(:post, @remote_link_url).with(
body: hash_including( body: hash_including(
GlobalID: 'GitLab', GlobalID: 'GitLab',
relationship: 'mentioned on',
object: { object: {
url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/#{commit_id}", 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 }, icon: { title: 'GitLab', url16x16: favicon_path },
status: { resolved: true } status: { resolved: true }
} }
......
...@@ -807,9 +807,10 @@ def cross_reference(type, link_exists = false) ...@@ -807,9 +807,10 @@ def cross_reference(type, link_exists = false)
expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with( expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with(
body: hash_including( body: hash_including(
GlobalID: "GitLab", GlobalID: "GitLab",
relationship: 'mentioned on',
object: { object: {
url: project_commit_url(project, commit), url: project_commit_url(project, commit),
title: "GitLab: Mentioned on commit - #{commit.title}", title: "Commit - #{commit.title}",
icon: { title: "GitLab", url16x16: favicon_path }, icon: { title: "GitLab", url16x16: favicon_path },
status: { resolved: false } status: { resolved: false }
} }
...@@ -833,9 +834,10 @@ def cross_reference(type, link_exists = false) ...@@ -833,9 +834,10 @@ def cross_reference(type, link_exists = false)
expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with( expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with(
body: hash_including( body: hash_including(
GlobalID: "GitLab", GlobalID: "GitLab",
relationship: 'mentioned on',
object: { object: {
url: project_issue_url(project, issue), url: project_issue_url(project, issue),
title: "GitLab: Mentioned on issue - #{issue.title}", title: "Issue - #{issue.title}",
icon: { title: "GitLab", url16x16: favicon_path }, icon: { title: "GitLab", url16x16: favicon_path },
status: { resolved: false } status: { resolved: false }
} }
...@@ -859,9 +861,10 @@ def cross_reference(type, link_exists = false) ...@@ -859,9 +861,10 @@ def cross_reference(type, link_exists = false)
expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with( expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with(
body: hash_including( body: hash_including(
GlobalID: "GitLab", GlobalID: "GitLab",
relationship: 'mentioned on',
object: { object: {
url: project_snippet_url(project, snippet), url: project_snippet_url(project, snippet),
title: "GitLab: Mentioned on snippet - #{snippet.title}", title: "Snippet - #{snippet.title}",
icon: { title: "GitLab", url16x16: favicon_path }, icon: { title: "GitLab", url16x16: favicon_path },
status: { resolved: false } status: { resolved: false }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment