Commit fd376b3e authored by Rémy Coutable's avatar Rémy Coutable

Revert "Merge branch '1937-https-clone-url-username' into 'master'

This reverts commit c425f366, reversing
changes made to 82f6c0f5.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent c5b0c530
...@@ -56,7 +56,7 @@ module ButtonHelper ...@@ -56,7 +56,7 @@ module ButtonHelper
content_tag (append_link ? :a : :span), protocol, content_tag (append_link ? :a : :span), protocol,
class: klass, class: klass,
href: (project.http_url_to_repo(current_user) if append_link), href: (project.http_url_to_repo if append_link),
data: { data: {
html: true, html: true,
placement: placement, placement: placement,
......
...@@ -276,7 +276,7 @@ module ProjectsHelper ...@@ -276,7 +276,7 @@ module ProjectsHelper
when 'ssh' when 'ssh'
project.ssh_url_to_repo project.ssh_url_to_repo
else else
project.http_url_to_repo(current_user) project.http_url_to_repo
end end
end end
......
...@@ -873,10 +873,8 @@ class Project < ActiveRecord::Base ...@@ -873,10 +873,8 @@ class Project < ActiveRecord::Base
url_to_repo url_to_repo
end end
def http_url_to_repo(user = nil) def http_url_to_repo
credentials = Gitlab::UrlSanitizer.http_credentials_for_user(user) "#{web_url}.git"
Gitlab::UrlSanitizer.new("#{web_url}.git", credentials: credentials).full_url
end end
def user_can_push_to_empty_repo?(user) def user_can_push_to_empty_repo?(user)
......
...@@ -49,7 +49,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps ...@@ -49,7 +49,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
step 'I should see an http link to the repository' do step 'I should see an http link to the repository' do
project = Project.find_by(name: 'Community') 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 end
step 'I should see an ssh link to the repository' do step 'I should see an ssh link to the repository' do
......
...@@ -32,7 +32,7 @@ feature 'Admin disables Git access protocol', feature: true do ...@@ -32,7 +32,7 @@ feature 'Admin disables Git access protocol', feature: true do
scenario 'shows only HTTP url' do scenario 'shows only HTTP url' do
visit_project 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') expect(page).not_to have_selector('#clone-dropdown')
end end
end end
......
...@@ -56,14 +56,8 @@ feature 'Developer views empty project instructions', feature: true do ...@@ -56,14 +56,8 @@ feature 'Developer views empty project instructions', feature: true do
end end
def expect_instructions_for(protocol) def expect_instructions_for(protocol)
url = msg = :"#{protocol.downcase}_url_to_repo"
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}") expect(page).to have_content("git clone #{project.send(msg)}")
end end
end end
...@@ -1909,22 +1909,12 @@ describe Project, models: true do ...@@ -1909,22 +1909,12 @@ describe Project, models: true do
describe '#http_url_to_repo' do describe '#http_url_to_repo' do
let(:project) { create :empty_project } let(:project) { create :empty_project }
context 'when no user is given' do
it 'returns the url to the repo without a username' 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).to eq("#{project.web_url}.git")
expect(project.http_url_to_repo).not_to include('@') expect(project.http_url_to_repo).not_to include('@')
end end
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
end
end
describe '#pipeline_status' do describe '#pipeline_status' do
let(:project) { create(:project) } let(:project) { create(:project) }
it 'builds a pipeline status' do it 'builds a pipeline status' do
......
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