summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-15 15:27:50 +0100
committerJames Lopez <james@jameslopez.es>2016-11-17 08:22:58 +0100
commitf93607a305346607f4296c266d40be1692febbec (patch)
tree945b639dc0a1a8d5ef741991ccf16ba3c2e9a066 /lib
parentca6da6ea3034a58c0edbc62336d2d49ea6e11fc9 (diff)
downloadgitlab-ce-f93607a305346607f4296c266d40be1692febbec.tar.gz
get rid of light url builder and fix wrong spec
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/light_url_builder.rb67
1 files changed, 0 insertions, 67 deletions
diff --git a/lib/gitlab/light_url_builder.rb b/lib/gitlab/light_url_builder.rb
deleted file mode 100644
index 0c86b122b88..00000000000
--- a/lib/gitlab/light_url_builder.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-module Gitlab
- # Similar to UrlBuilder, but using IDs to avoid querying the DB for objects
- # Useful for using in conjunction with Arel queries.
- class LightUrlBuilder
- include Gitlab::Routing.url_helpers
- include GitlabRoutingHelper
- include ActionView::RecordIdentifier
-
- def self.build(*args)
- new(*args).url
- end
-
- def initialize(entity:, project: nil, id:, opts: {})
- @entity = entity
- @project = project
- @id = id
- @opts = opts
- end
-
- def url
- url_method = "#{@entity}_url"
- raise NotImplementedError.new("No Light URL builder defined for #{@entity}") unless respond_to?(url_method)
-
- public_send(url_method)
- end
-
- def issue_url
- namespace_project_issue_url({
- namespace_id: @project.namespace,
- project_id: @project,
- id: @id
- }.merge!(@opts))
- end
-
- def user_avatar_url
- User.find(@id).avatar_url
- end
-
- def commit_url
- namespace_project_commit_url({
- namespace_id: @project.namespace,
- project_id: @project,
- id: @id
- }.merge!(@opts))
- end
-
- def merge_request_url
- namespace_project_merge_request_url({
- namespace_id: @project.namespace,
- project_id: @project,
- id: @id
- }.merge!(@opts))
- end
-
- def branch_url
- namespace_project_commit_url(@project.namespace, @project, @id)
- end
-
- def user_url
- Gitlab::Routing.url_helpers.user_url(@id)
- end
-
- def build_url
- namespace_project_build_url(@project.namespace, @project, @id)
- end
- end
-end