diff options
Diffstat (limited to 'lib/gitlab/gl_repository.rb')
-rw-r--r-- | lib/gitlab/gl_repository.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/gl_repository.rb b/lib/gitlab/gl_repository.rb index 99bf4258c07..347084e779c 100644 --- a/lib/gitlab/gl_repository.rb +++ b/lib/gitlab/gl_repository.rb @@ -7,12 +7,13 @@ module Gitlab PROJECT = RepoType.new( name: :project, access_checker_class: Gitlab::GitAccess, - repository_accessor: -> (project) { project.repository } + repository_resolver: -> (project) { project.repository } ).freeze WIKI = RepoType.new( name: :wiki, access_checker_class: Gitlab::GitAccessWiki, - repository_accessor: -> (project) { project.wiki.repository } + repository_resolver: -> (project) { project.wiki.repository }, + suffix: :wiki ).freeze TYPES = { @@ -27,15 +28,14 @@ module Gitlab def self.parse(gl_repository) type_name, _id = gl_repository.split('-').first type = types[type_name] - subject_id = type&.fetch_id(gl_repository) - unless subject_id + unless type raise ArgumentError, "Invalid GL Repository \"#{gl_repository}\"" end - project = Project.find_by_id(subject_id) + container = type.fetch_container!(gl_repository) - [project, type] + [container, type] end def self.default_type |