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.
This commit is contained in:
parent
234f4bf20f
commit
88217029fc
1 changed files with 12 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue