Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-24 11:37:15 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-24 11:37:15 +0400
commitaadef92f1d494e7d59e4238132c7b1a9c8986a84 (patch)
tree43ddf50b7598bab706b85d5c257662278ac9005d /lib/gitlab
parente7cf10e4468823fc6cf12a280a3d7a7e009e045d (diff)
parent8880c55a1ee35877abd7229e65b359116e33b5d1 (diff)
Merge pull request #7013 from jvanbaarsen/better-webhook-information
Return a little more information in Issue webhook
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/url_builder.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
new file mode 100644
index 00000000000..de7e0404086
--- /dev/null
+++ b/lib/gitlab/url_builder.rb
@@ -0,0 +1,25 @@
+module Gitlab
+ class UrlBuilder
+ include Rails.application.routes.url_helpers
+
+ def initialize(type)
+ @type = type
+ end
+
+ def build(id)
+ case @type
+ when :issue
+ issue_url(id)
+ end
+ end
+
+ private
+
+ def issue_url(id)
+ issue = Issue.find(id)
+ project_issue_url(id: issue.iid,
+ project_id: issue.project,
+ host: Settings.gitlab['url'])
+ end
+ end
+end