Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
915bd35e
Commit
915bd35e
authored
Dec 05, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code to use original protocol
parent
1f9f1706
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
ee/lib/ee/gitlab/geo_git_access.rb
ee/lib/ee/gitlab/geo_git_access.rb
+11
-3
spec/ee/spec/lib/ee/gitlab/git_access_spec.rb
spec/ee/spec/lib/ee/gitlab/git_access_spec.rb
+2
-1
spec/ee/spec/lib/ee/gitlab/git_access_wiki_spec.rb
spec/ee/spec/lib/ee/gitlab/git_access_wiki_spec.rb
+1
-0
No files found.
ee/lib/ee/gitlab/geo_git_access.rb
View file @
915bd35e
...
@@ -10,14 +10,22 @@ module EE
...
@@ -10,14 +10,22 @@ module EE
def
push_to_read_only_message
def
push_to_read_only_message
message
=
super
message
=
super
if
::
Gitlab
::
Geo
.
primary_node
if
::
Gitlab
::
Geo
.
secondary_with_primary?
clone_url
=
geo_primary_default_url_to_repo
(
project_or_wiki
)
message
+=
" Please use the Primary node URL:
#{
geo_primary_url_to_repo
}
. Documentation:
#{
GEO_SERVER_DOCS_URL
}
"
message
+=
" Please use the Primary node URL:
#{
clone_url
}
. Documentation:
#{
GEO_SERVER_DOCS_URL
}
"
end
end
message
message
end
end
def
geo_primary_url_to_repo
case
protocol
when
'ssh'
geo_primary_ssh_url_to_repo
(
project_or_wiki
)
else
geo_primary_http_url_to_repo
(
project_or_wiki
)
end
end
def
current_user
def
current_user
user
user
end
end
...
...
spec/ee/spec/lib/ee/gitlab/git_access_spec.rb
View file @
915bd35e
...
@@ -5,7 +5,7 @@ describe Gitlab::GitAccess do
...
@@ -5,7 +5,7 @@ describe Gitlab::GitAccess do
let
(
:actor
)
{
user
}
let
(
:actor
)
{
user
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:protocol
)
{
'
ssh
'
}
let
(
:protocol
)
{
'
web
'
}
let
(
:authentication_abilities
)
{
%i[read_project download_code push_code]
}
let
(
:authentication_abilities
)
{
%i[read_project download_code push_code]
}
let
(
:redirected_path
)
{
nil
}
let
(
:redirected_path
)
{
nil
}
...
@@ -30,6 +30,7 @@ describe Gitlab::GitAccess do
...
@@ -30,6 +30,7 @@ describe Gitlab::GitAccess do
primary_node
=
create
(
:geo_node
,
:primary
,
url:
'https://localhost:3000/gitlab'
)
primary_node
=
create
(
:geo_node
,
:primary
,
url:
'https://localhost:3000/gitlab'
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:primary
).
and_return
(
primary_node
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:primary
).
and_return
(
primary_node
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary_with_primary?
).
and_return
(
true
)
project
.
add_master
(
user
)
project
.
add_master
(
user
)
...
...
spec/ee/spec/lib/ee/gitlab/git_access_wiki_spec.rb
View file @
915bd35e
...
@@ -34,6 +34,7 @@ describe Gitlab::GitAccessWiki do
...
@@ -34,6 +34,7 @@ describe Gitlab::GitAccessWiki do
primary_node
=
create
(
:geo_node
,
:primary
,
url:
'https://localhost:3000/gitlab'
)
primary_node
=
create
(
:geo_node
,
:primary
,
url:
'https://localhost:3000/gitlab'
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:primary
).
and_return
(
primary_node
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:primary
).
and_return
(
primary_node
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary_with_primary?
).
and_return
(
true
)
project
.
add_master
(
user
)
project
.
add_master
(
user
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment