summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-05-30 14:11:58 +0200
committerRémy Coutable <remy@rymai.me>2017-05-30 14:11:58 +0200
commitfd376b3ed4de310f8e599cbbeb5c18e5a31c188c (patch)
tree64554869813bc736668d93efc9b863fc28a5b435
parentc5b0c530bf93e4525f8573dea14abd3f927b0f90 (diff)
downloadgitlab-ce-fd376b3ed4de310f8e599cbbeb5c18e5a31c188c.tar.gz
Revert "Merge branch '1937-https-clone-url-username' into 'master' "
This reverts commit c425f366bfa84efab92b5d5e1d0721f16a2890bc, reversing changes made to 82f6c0f5ac4ed29390ed90592d2c431f3494d93f. Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--app/helpers/button_helper.rb2
-rw-r--r--app/helpers/projects_helper.rb2
-rw-r--r--app/models/project.rb6
-rw-r--r--features/steps/explore/projects.rb2
-rw-r--r--spec/features/admin/admin_disables_git_access_protocol_spec.rb2
-rw-r--r--spec/features/projects/developer_views_empty_project_instructions_spec.rb12
-rw-r--r--spec/models/project_spec.rb16
7 files changed, 12 insertions, 30 deletions
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb
index 206d0753f08..0081bbd92b3 100644
--- a/app/helpers/button_helper.rb
+++ b/app/helpers/button_helper.rb
@@ -56,7 +56,7 @@ module ButtonHelper
content_tag (append_link ? :a : :span), protocol,
class: klass,
- href: (project.http_url_to_repo(current_user) if append_link),
+ href: (project.http_url_to_repo if append_link),
data: {
html: true,
placement: placement,
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 654aa1a6533..7b0584c42a2 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -276,7 +276,7 @@ module ProjectsHelper
when 'ssh'
project.ssh_url_to_repo
else
- project.http_url_to_repo(current_user)
+ project.http_url_to_repo
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 29af57d7664..990db73f0d7 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -873,10 +873,8 @@ class Project < ActiveRecord::Base
url_to_repo
end
- def http_url_to_repo(user = nil)
- credentials = Gitlab::UrlSanitizer.http_credentials_for_user(user)
-
- Gitlab::UrlSanitizer.new("#{web_url}.git", credentials: credentials).full_url
+ def http_url_to_repo
+ "#{web_url}.git"
end
def user_can_push_to_empty_repo?(user)
diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb
index b2194275751..1a55f40abb9 100644
--- a/features/steps/explore/projects.rb
+++ b/features/steps/explore/projects.rb
@@ -49,7 +49,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
step 'I should see an http link to the repository' do
project = Project.find_by(name: 'Community')
- expect(page).to have_field('project_clone', with: project.http_url_to_repo(@user))
+ expect(page).to have_field('project_clone', with: project.http_url_to_repo)
end
step 'I should see an ssh link to the repository' do
diff --git a/spec/features/admin/admin_disables_git_access_protocol_spec.rb b/spec/features/admin/admin_disables_git_access_protocol_spec.rb
index 273cacd82cd..e8e080ce3e2 100644
--- a/spec/features/admin/admin_disables_git_access_protocol_spec.rb
+++ b/spec/features/admin/admin_disables_git_access_protocol_spec.rb
@@ -32,7 +32,7 @@ feature 'Admin disables Git access protocol', feature: true do
scenario 'shows only HTTP url' do
visit_project
- expect(page).to have_content("git clone #{project.http_url_to_repo(admin)}")
+ expect(page).to have_content("git clone #{project.http_url_to_repo}")
expect(page).not_to have_selector('#clone-dropdown')
end
end
diff --git a/spec/features/projects/developer_views_empty_project_instructions_spec.rb b/spec/features/projects/developer_views_empty_project_instructions_spec.rb
index 2352329d58c..0c51fe72ca4 100644
--- a/spec/features/projects/developer_views_empty_project_instructions_spec.rb
+++ b/spec/features/projects/developer_views_empty_project_instructions_spec.rb
@@ -56,14 +56,8 @@ feature 'Developer views empty project instructions', feature: true do
end
def expect_instructions_for(protocol)
- url =
- case protocol
- when 'ssh'
- project.ssh_url_to_repo
- when 'http'
- project.http_url_to_repo(developer)
- end
-
- expect(page).to have_content("git clone #{url}")
+ msg = :"#{protocol.downcase}_url_to_repo"
+
+ expect(page).to have_content("git clone #{project.send(msg)}")
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 36575acf671..2ef3d5654d5 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1909,19 +1909,9 @@ describe Project, models: true do
describe '#http_url_to_repo' do
let(:project) { create :empty_project }
- context 'when no user is given' do
- it 'returns the url to the repo without a username' do
- expect(project.http_url_to_repo).to eq("#{project.web_url}.git")
- expect(project.http_url_to_repo).not_to include('@')
- end
- end
-
- context 'when user is given' do
- it 'returns the url to the repo with the username' do
- user = build_stubbed(:user)
-
- expect(project.http_url_to_repo(user)).to start_with("http://#{user.username}@")
- end
+ it 'returns the url to the repo without a username' do
+ expect(project.http_url_to_repo).to eq("#{project.web_url}.git")
+ expect(project.http_url_to_repo).not_to include('@')
end
end