Commit 88217029 authored by Eirik Lygre's avatar Eirik Lygre

When rendering the clone page, check user profile to decide default clone...

When rendering the clone page, check user profile to decide default clone protocol. If the user has uploaded SSH-keys, use SSH; otherwise, use http(s). Close #3504.
parent 234f4bf2
......@@ -175,11 +175,21 @@ module ProjectsHelper
end
def default_url_to_repo(project = @project)
current_user ? project.url_to_repo : project.http_url_to_repo
if default_clone_protocol == "ssh"
project.ssh_url_to_repo
else
project.http_url_to_repo
end
end
def default_clone_protocol
current_user ? "ssh" : "http"
if !current_user
"http"
elsif current_user.require_ssh_key?
"http"
else
"ssh"
end
end
def project_last_activity(project)
......
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