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

manifest_provider_repo_entity.rb « import « serializers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5da9aae80a8d4f90c5a6ba1441947ce9fde713d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class Import::ManifestProviderRepoEntity < Import::BaseProviderRepoEntity
  expose :id
  expose :full_name, override: true do |repo|
    repo[:url]
  end

  expose :provider_link, override: true do |repo|
    repo[:url]
  end

  expose :target do |repo, options|
    import_project_target(options[:group_full_path], repo[:path], options[:request].current_user)
  end

  private

  def import_project_target(owner, name, user)
    namespace = user.can_create_group? ? owner : user.namespace_path
    "#{namespace}/#{name}"
  end
end