@@ -25,8 +25,8 @@ var Funcs template.FuncMap = map[string]interface{}{ | |||||
"GoVer": func() string { | "GoVer": func() string { | ||||
return strings.Title(runtime.Version()) | return strings.Title(runtime.Version()) | ||||
}, | }, | ||||
"Protocol": func() string { | |||||
return string(setting.Protocol) | |||||
"UseHTTPS": func() bool { | |||||
return strings.HasPrefix(setting.AppUrl, "https") | |||||
}, | }, | ||||
"AppName": func() string { | "AppName": func() string { | ||||
return setting.AppName | return setting.AppName | ||||
@@ -448,7 +448,7 @@ func ParseCompareInfo(ctx *middleware.Context) (*models.User, *models.Repository | |||||
// Check if current user has fork of repository. | // Check if current user has fork of repository. | ||||
headRepo, has := models.HasForkedRepo(headUser.Id, repo.ID) | headRepo, has := models.HasForkedRepo(headUser.Id, repo.ID) | ||||
if !has || !ctx.User.IsAdminOfRepo(headRepo) { | |||||
if !has || (!ctx.User.IsAdminOfRepo(headRepo) && !ctx.User.IsAdmin) { | |||||
ctx.Handle(404, "HasForkedRepo", nil) | ctx.Handle(404, "HasForkedRepo", nil) | ||||
return nil, nil, nil, nil, "", "" | return nil, nil, nil, nil, "", "" | ||||
} | } | ||||
@@ -22,7 +22,7 @@ | |||||
</button> | </button> | ||||
{{end}} | {{end}} | ||||
<button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> | <button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> | ||||
HTTPS | |||||
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} | |||||
</button> | </button> | ||||
<input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly> | <input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly> | ||||
<button class="ui basic button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> | <button class="ui basic button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> | ||||
@@ -18,7 +18,7 @@ | |||||
</button> | </button> | ||||
{{end}} | {{end}} | ||||
<button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> | <button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> | ||||
{{if eq Protocol "http"}}HTTP{{else}}HTTPS{{end}} | |||||
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} | |||||
</button> | </button> | ||||
<input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly> | <input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly> | ||||
<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> | <button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> | ||||