diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-02-14 16:03:24 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-02-14 18:38:20 +0200 |
commit | 6676b4f0dd05ffb6071a3329cca4459e7cddcdc3 (patch) | |
tree | bd6fa5fa8b337f38406a0bf5376e19db44fd1eaa /app | |
parent | c48539463ff2250058fbfa9d1811977f01313b7c (diff) | |
download | gitlab-ce-6676b4f0dd05ffb6071a3329cca4459e7cddcdc3.tar.gz |
Use Namespace#full_path instead of Namespace#path
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/namespaces_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/submodule_helper.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 28 | ||||
-rw-r--r-- | app/models/project_services/drone_ci_service.rb | 6 | ||||
-rw-r--r-- | app/services/projects/transfer_service.rb | 6 | ||||
-rw-r--r-- | app/views/admin/dashboard/index.html.haml | 2 | ||||
-rw-r--r-- | app/views/import/base/unauthorized.js.haml | 2 | ||||
-rw-r--r-- | app/views/projects/edit.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/group_links/_index.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/pages_domains/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/shared/members/_group.html.haml | 2 |
12 files changed, 33 insertions, 27 deletions
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index e0b8dc1393b..0676767d910 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -10,7 +10,7 @@ module NamespacesHelper data_attr_users = { 'data-options-parent' => 'users' } group_opts = [ - "Groups", groups.sort_by(&:human_name).map { |g| [display_path ? g.path : g.human_name, g.id, data_attr_group] } + "Groups", groups.sort_by(&:human_name).map { |g| [display_path ? g.full_path : g.human_name, g.id, data_attr_group] } ] users_opts = [ diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index b3f50ceebe4..9a748aaaf33 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -63,7 +63,7 @@ module SubmoduleHelper namespace = components.pop.gsub(/^\.\.$/, '') if namespace.empty? - namespace = @project.namespace.path + namespace = @project.namespace.full_path end [ diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 38646eba3ac..204d2b153ad 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -598,7 +598,7 @@ class MergeRequest < ActiveRecord::Base def source_project_namespace if source_project && source_project.namespace - source_project.namespace.path + source_project.namespace.full_path else "(removed)" end @@ -606,7 +606,7 @@ class MergeRequest < ActiveRecord::Base def target_project_namespace if target_project && target_project.namespace - target_project.namespace.path + target_project.namespace.full_path else "(removed)" end diff --git a/app/models/project.rb b/app/models/project.rb index aa408b4556e..ed43fc2e575 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -454,7 +454,7 @@ class Project < ActiveRecord::Base if forked? job_id = RepositoryForkWorker.perform_async(id, forked_from_project.repository_storage_path, forked_from_project.path_with_namespace, - self.namespace.path) + self.namespace.full_path) else job_id = RepositoryImportWorker.perform_async(self.id) end @@ -942,8 +942,8 @@ class Project < ActiveRecord::Base Gitlab::AppLogger.info "Project was renamed: #{old_path_with_namespace} -> #{new_path_with_namespace}" - Gitlab::UploadsTransfer.new.rename_project(path_was, path, namespace.path) - Gitlab::PagesTransfer.new.rename_project(path_was, path, namespace.path) + Gitlab::UploadsTransfer.new.rename_project(path_was, path, namespace.full_path) + Gitlab::PagesTransfer.new.rename_project(path_was, path, namespace.full_path) end # Expires various caches before a project is renamed. @@ -1150,19 +1150,25 @@ class Project < ActiveRecord::Base end def pages_url + subdomain, _, url_path = full_path.partition('/') + # The hostname always needs to be in downcased # All web servers convert hostname to lowercase - host = "#{namespace.path}.#{Settings.pages.host}".downcase + host = "#{subdomain}.#{Settings.pages.host}".downcase # The host in URL always needs to be downcased url = Gitlab.config.pages.url.sub(/^https?:\/\//) do |prefix| - "#{prefix}#{namespace.path}." + "#{prefix}#{subdomain}." end.downcase # If the project path is the same as host, we serve it as group page - return url if host == path + return url if host == url_path + + "#{url}/#{url_path}" + end - "#{url}/#{path}" + def pages_subdomain + full_path.partition('/').first end def pages_path @@ -1179,8 +1185,8 @@ class Project < ActiveRecord::Base # 3. We asynchronously remove pages with force temp_path = "#{path}.#{SecureRandom.hex}.deleted" - if Gitlab::PagesTransfer.new.rename_project(path, temp_path, namespace.path) - PagesWorker.perform_in(5.minutes, :remove, namespace.path, temp_path) + if Gitlab::PagesTransfer.new.rename_project(path, temp_path, namespace.full_path) + PagesWorker.perform_in(5.minutes, :remove, namespace.full_path, temp_path) end end @@ -1230,7 +1236,7 @@ class Project < ActiveRecord::Base end def ensure_dir_exist - gitlab_shell.add_namespace(repository_storage_path, namespace.path) + gitlab_shell.add_namespace(repository_storage_path, namespace.full_path) end def predefined_variables @@ -1238,7 +1244,7 @@ class Project < ActiveRecord::Base { key: 'CI_PROJECT_ID', value: id.to_s, public: true }, { key: 'CI_PROJECT_NAME', value: path, public: true }, { key: 'CI_PROJECT_PATH', value: path_with_namespace, public: true }, - { key: 'CI_PROJECT_NAMESPACE', value: namespace.path, public: true }, + { key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path, public: true }, { key: 'CI_PROJECT_URL', value: web_url, public: true } ] end diff --git a/app/models/project_services/drone_ci_service.rb b/app/models/project_services/drone_ci_service.rb index 0a217d8caba..942ec9371e5 100644 --- a/app/models/project_services/drone_ci_service.rb +++ b/app/models/project_services/drone_ci_service.rb @@ -12,7 +12,7 @@ class DroneCiService < CiService def compose_service_hook hook = service_hook || build_service_hook # If using a service template, project may not be available - hook.url = [drone_url, "/api/hook", "?owner=#{project.namespace.path}", "&name=#{project.path}", "&access_token=#{token}"].join if project + hook.url = [drone_url, "/api/hook", "?owner=#{project.namespace.full_path}", "&name=#{project.path}", "&access_token=#{token}"].join if project hook.enable_ssl_verification = !!enable_ssl_verification hook.save end @@ -38,7 +38,7 @@ class DroneCiService < CiService def commit_status_path(sha, ref) url = [drone_url, - "gitlab/#{project.namespace.path}/#{project.path}/commits/#{sha}", + "gitlab/#{project.full_path}/commits/#{sha}", "?branch=#{URI::encode(ref.to_s)}&access_token=#{token}"] URI.join(*url).to_s @@ -73,7 +73,7 @@ class DroneCiService < CiService def build_page(sha, ref) url = [drone_url, - "gitlab/#{project.namespace.path}/#{project.path}/redirect/commits/#{sha}", + "gitlab/#{project.full_path}/redirect/commits/#{sha}", "?branch=#{URI::encode(ref.to_s)}"] URI.join(*url).to_s diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 484700c8c29..20dfbddc823 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -30,7 +30,7 @@ module Projects Project.transaction do old_path = project.path_with_namespace old_group = project.group - new_path = File.join(new_namespace.try(:path) || '', project.path) + new_path = File.join(new_namespace.try(:full_path) || '', project.path) if Project.where(path: project.path, namespace_id: new_namespace.try(:id)).present? raise TransferError.new("Project with same path in target namespace already exists") @@ -63,10 +63,10 @@ module Projects Labels::TransferService.new(current_user, old_group, project).execute # Move uploads - Gitlab::UploadsTransfer.new.move_project(project.path, old_namespace.path, new_namespace.path) + Gitlab::UploadsTransfer.new.move_project(project.path, old_namespace.full_path, new_namespace.full_path) # Move pages - Gitlab::PagesTransfer.new.move_project(project.path, old_namespace.path, new_namespace.path) + Gitlab::PagesTransfer.new.move_project(project.path, old_namespace.full_path, new_namespace.full_path) project.old_path_with_namespace = old_path diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index 5238623e936..e67ad663720 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -163,6 +163,6 @@ - @groups.each do |group| %p = link_to [:admin, group], class: 'str-truncated-60' do - = group.name + = group.full_name %span.light.pull-right #{time_ago_with_tooltip(group.created_at)} diff --git a/app/views/import/base/unauthorized.js.haml b/app/views/import/base/unauthorized.js.haml index 36f8069c1f7..ada5f99f4e2 100644 --- a/app/views/import/base/unauthorized.js.haml +++ b/app/views/import/base/unauthorized.js.haml @@ -4,7 +4,7 @@ import_button = tr.find(".btn-import") origin_target = target_field.text() project_name = "#{@project_name}" - origin_namespace = "#{@target_namespace.path}" + origin_namespace = "#{@target_namespace.full_path}" target_field.empty() target_field.append("<p class='alert alert-danger'>This namespace has already been taken! Please choose another one.</p>") target_field.append("<input type='text' name='target_namespace' />") diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 9c5c1a6d707..f2905fa3ce9 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -232,7 +232,7 @@ .form-group .input-group .input-group-addon - #{URI.join(root_url, @project.namespace.path)}/ + #{URI.join(root_url, @project.namespace.full_path)}/ = f.text_field :path, class: 'form-control' %ul %li Be careful. Renaming a project's repository can have unintended side effects. diff --git a/app/views/projects/group_links/_index.html.haml b/app/views/projects/group_links/_index.html.haml index 99d0df2ac34..b6116dbec41 100644 --- a/app/views/projects/group_links/_index.html.haml +++ b/app/views/projects/group_links/_index.html.haml @@ -39,7 +39,7 @@ = icon("folder-open-o", class: "settings-list-icon") .pull-left = link_to group do - = group.name + = group.full_name %br up to #{group_link.human_access} - if group_link.expires? diff --git a/app/views/projects/pages_domains/show.html.haml b/app/views/projects/pages_domains/show.html.haml index 52dddb052a7..876cac0dacb 100644 --- a/app/views/projects/pages_domains/show.html.haml +++ b/app/views/projects/pages_domains/show.html.haml @@ -17,7 +17,7 @@ %p To access the domain create a new DNS record: %pre - #{@domain.domain} CNAME #{@domain.project.namespace.path}.#{Settings.pages.host}. + #{@domain.domain} CNAME #{@domain.project.pages_subdomain}.#{Settings.pages.host}. %tr %td Certificate diff --git a/app/views/shared/members/_group.html.haml b/app/views/shared/members/_group.html.haml index 81b5bc1de30..1d5a61cffce 100644 --- a/app/views/shared/members/_group.html.haml +++ b/app/views/shared/members/_group.html.haml @@ -6,7 +6,7 @@ %span.list-item-name = image_tag group_icon(group), class: "avatar s40", alt: '' %strong - = link_to group.name, group_path(group) + = link_to group.full_name, group_path(group) .cgray Joined #{time_ago_with_tooltip(group.created_at)} - if group_link.expires? |