Commit abc69c89 authored by Jeroen van Baarsen's avatar Jeroen van Baarsen

Merge branch 'fix-merge-request-url-builder' into 'master'

Fix merge request URL passed to Webhooks

If you look at the data structure passed to Webhooks, you will see:

`"url"=>nil`

I don't think any of the Webhooks or services are using this yet, so right now nothing so far depends upon this value being correct.

See merge request !352
parents 2f4656b5 e363f2e6
Please view this file on the master branch, on stable branches it's out of date.
v 7.9.0 (unreleased)
- Fix merge request URL passed to Webhooks. (Stan Hu)
- Move labels/milestones tabs to sidebar
- Upgrade Rails gem to version 4.1.9.
- Improve error messages for file edit failures
......
......@@ -10,6 +10,8 @@ module Gitlab
case @type
when :issue
issue_url(id)
when :merge_request
merge_request_url(id)
end
end
......@@ -22,5 +24,12 @@ module Gitlab
project_id: issue.project,
host: Gitlab.config.gitlab['url'])
end
def merge_request_url(id)
merge_request = MergeRequest.find(id)
project_merge_request_url(id: merge_request.id,
project_id: merge_request.project,
host: Gitlab.config.gitlab['url'])
end
end
end
......@@ -8,4 +8,12 @@ describe Gitlab::UrlBuilder do
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.path_with_namespace}/issues/#{issue.iid}"
end
end
describe 'When asking for an merge request' do
it 'returns the merge request url' do
merge_request = create(:merge_request)
url = Gitlab::UrlBuilder.new(:merge_request).build(merge_request.id)
expect(url).to eq "#{Settings.gitlab['url']}/#{merge_request.project.to_param}/merge_requests/#{merge_request.id}"
end
end
end
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