Commit 97173f98 authored by Stan Hu's avatar Stan Hu

Merge branch 'ee-remove-project_or_wiki' into 'master'

Refactor project_or_wiki to container

See merge request gitlab-org/gitlab!29398
parents 99c79595 9ae21465
......@@ -5,24 +5,24 @@ module EE
include ::ProjectsHelper
include ::ApplicationSettingsHelper
def geo_primary_web_url(project_or_wiki)
File.join(::Gitlab::Geo.primary_node.url, project_or_wiki.full_path)
def geo_primary_web_url(repository_container)
File.join(::Gitlab::Geo.primary_node.url, repository_container.full_path)
end
def geo_primary_ssh_url_to_repo(project_or_wiki)
"#{::Gitlab::Geo.primary_node.clone_url_prefix}#{project_or_wiki.full_path}.git"
def geo_primary_ssh_url_to_repo(repository_container)
"#{::Gitlab::Geo.primary_node.clone_url_prefix}#{repository_container.full_path}.git"
end
def geo_primary_http_url_to_repo(project_or_wiki)
geo_primary_web_url(project_or_wiki) + '.git'
def geo_primary_http_url_to_repo(repository_container)
geo_primary_web_url(repository_container) + '.git'
end
def geo_primary_default_url_to_repo(project_or_wiki)
def geo_primary_default_url_to_repo(repository_container)
case default_clone_protocol
when 'ssh'
geo_primary_ssh_url_to_repo(project_or_wiki)
geo_primary_ssh_url_to_repo(repository_container)
else
geo_primary_http_url_to_repo(project_or_wiki)
geo_primary_http_url_to_repo(repository_container)
end
end
......
......@@ -10,12 +10,6 @@ module EE
GEO_SERVER_DOCS_URL = 'https://docs.gitlab.com/ee/administration/geo/replication/using_a_geo_server.html'.freeze
protected
def project_or_wiki
project
end
private
def custom_action_for?(cmd)
......@@ -61,18 +55,18 @@ module EE
def geo_primary_url_to_repo
case protocol
when 'ssh'
geo_primary_ssh_url_to_repo(project_or_wiki)
geo_primary_ssh_url_to_repo(container)
else
geo_primary_http_url_to_repo(project_or_wiki)
geo_primary_http_url_to_repo(container)
end
end
def primary_http_repo_url
geo_primary_http_url_to_repo(project_or_wiki)
geo_primary_http_url_to_repo(container)
end
def primary_ssh_url_to_repo
geo_primary_ssh_url_to_repo(project_or_wiki)
geo_primary_ssh_url_to_repo(container)
end
def current_replication_lag_message
......
# frozen_string_literal: true
module EE
module Gitlab
module GitAccessWiki
include GeoGitAccess
private
def project_or_wiki
project.wiki
end
end
end
end
......@@ -2,8 +2,6 @@
module Gitlab
class GitAccessWiki < GitAccess
prepend_if_ee('EE::Gitlab::GitAccessWiki') # rubocop: disable Cop/InjectEnterpriseEditionModule
ERROR_MESSAGES = {
read_only: "You can't push code to a read-only GitLab instance.",
write_to_wiki: "You are not allowed to write to this project's wiki."
......@@ -33,10 +31,8 @@ module Gitlab
ERROR_MESSAGES[:read_only]
end
private
def repository
project.wiki.repository
def container
project.wiki
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment