mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Implementation of all repositories of a user from user->settings (#1740)
* Implementation of all repositories of a user from user->settings * Update message when no repository found * Update according to comments * Change UI to have a better look * improved user repositories UI
This commit is contained in:
committed by
Lauris BH
parent
1739e84ac0
commit
e5d80b7090
@@ -39,6 +39,7 @@ const (
|
||||
tplSettingsTwofaEnroll base.TplName = "user/settings/twofa_enroll"
|
||||
tplSettingsAccountLink base.TplName = "user/settings/account_link"
|
||||
tplSettingsOrganization base.TplName = "user/settings/organization"
|
||||
tplSettingsRepositories base.TplName = "user/settings/repos"
|
||||
tplSettingsDelete base.TplName = "user/settings/delete"
|
||||
tplSecurity base.TplName = "user/security"
|
||||
)
|
||||
@@ -785,3 +786,37 @@ func SettingsOrganization(ctx *context.Context) {
|
||||
ctx.Data["Orgs"] = orgs
|
||||
ctx.HTML(200, tplSettingsOrganization)
|
||||
}
|
||||
|
||||
// SettingsRepos display a list of all repositories of the user
|
||||
func SettingsRepos(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("settings")
|
||||
ctx.Data["PageIsSettingsRepos"] = true
|
||||
ctxUser := ctx.User
|
||||
|
||||
var err error
|
||||
if err = ctxUser.GetRepositories(1, setting.UI.User.RepoPagingNum); err != nil {
|
||||
ctx.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
}
|
||||
repos := ctxUser.Repos
|
||||
|
||||
for i := range repos {
|
||||
if repos[i].IsFork {
|
||||
err := repos[i].GetBaseRepo()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetBaseRepo", err)
|
||||
return
|
||||
}
|
||||
err = repos[i].BaseRepo.GetOwner()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetOwner", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Data["Owner"] = ctxUser
|
||||
ctx.Data["Repos"] = repos
|
||||
|
||||
ctx.HTML(200, tplSettingsRepositories)
|
||||
}
|
||||
|
Reference in New Issue
Block a user