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:
Diffstat (limited to 'lib/gitlab/url_builder.rb')
-rw-r--r--lib/gitlab/url_builder.rb60
1 files changed, 0 insertions, 60 deletions
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
deleted file mode 100644
index 11b0d44f340..00000000000
--- a/lib/gitlab/url_builder.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-module Gitlab
- class UrlBuilder
- include Rails.application.routes.url_helpers
- include GitlabRoutingHelper
-
- def initialize(type)
- @type = type
- end
-
- def build(id)
- case @type
- when :issue
- build_issue_url(id)
- when :merge_request
- build_merge_request_url(id)
- when :note
- build_note_url(id)
-
- end
- end
-
- private
-
- def build_issue_url(id)
- issue = Issue.find(id)
- issue_url(issue, host: Gitlab.config.gitlab['url'])
- end
-
- def build_merge_request_url(id)
- merge_request = MergeRequest.find(id)
- merge_request_url(merge_request, host: Gitlab.config.gitlab['url'])
- end
-
- def build_note_url(id)
- note = Note.find(id)
- if note.for_commit?
- namespace_project_commit_url(namespace_id: note.project.namespace,
- id: note.commit_id,
- project_id: note.project,
- host: Gitlab.config.gitlab['url'],
- anchor: "note_#{note.id}")
- elsif note.for_issue?
- issue = Issue.find(note.noteable_id)
- issue_url(issue,
- host: Gitlab.config.gitlab['url'],
- anchor: "note_#{note.id}")
- elsif note.for_merge_request?
- merge_request = MergeRequest.find(note.noteable_id)
- merge_request_url(merge_request,
- host: Gitlab.config.gitlab['url'],
- anchor: "note_#{note.id}")
- elsif note.for_project_snippet?
- snippet = Snippet.find(note.noteable_id)
- project_snippet_url(snippet,
- host: Gitlab.config.gitlab['url'],
- anchor: "note_#{note.id}")
- end
- end
- end
-end