Commit 3e697062 authored by Marin Jankovski's avatar Marin Jankovski

Nicer closing message in comment.

parent 1173f2e7
......@@ -95,18 +95,18 @@ class JiraService < IssueTrackerService
def close_issue(push_data, issue_name)
url = close_issue_url(issue_name)
commit_url = push_data[:commits].first[:url]
commit = push_data[:commits].first
message = {
'update' => {
'comment' => [{
'add' => {
'body' => "Issue solved with #{commit_url}"
update: {
comment: [{
add: {
body: "Issue solved with [#{commit[:id]}|#{commit[:url]}]."
}
}]
},
'transition' => {
'id' => jira_issue_transition_id
transition: {
id: jira_issue_transition_id
}
}.to_json
......@@ -130,13 +130,6 @@ class JiraService < IssueTrackerService
send_message(url, message)
end
def close_issue_url(issue_name)
"#{server_url}/rest/api/#{self.api_version}/issue/#{issue_name}/transitions"
end
def add_comment_url(issue_name)
"#{server_url}/rest/api/#{self.api_version}/issue/#{issue_name}/comment"
end
def auth
require 'base64'
......@@ -185,4 +178,13 @@ class JiraService < IssueTrackerService
def resource_url(resource)
"#{Settings.gitlab['url'].chomp("/")}#{resource}"
end
def close_issue_url(issue_name)
"#{server_url}/rest/api/#{self.api_version}/issue/#{issue_name}/transitions"
end
def add_comment_url(issue_name)
"#{server_url}/rest/api/#{self.api_version}/issue/#{issue_name}/comment"
end
end
......@@ -273,7 +273,7 @@ describe GitPushService do
update: {
comment: [{
add: {
body: "Issue solved with http://localhost/#{project.path_with_namespace}/commit/#{closing_commit.id}"
body: "Issue solved with [#{closing_commit.id}|http://localhost/#{project.path_with_namespace}/commit/#{closing_commit.id}]."
}
}]
},
......
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