mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 14:54:12 +01:00
Only show repositories on organization dashboard, that the user has access to
This commit is contained in:
parent
d4583ebd4b
commit
90e9e3c89d
1 changed files with 15 additions and 5 deletions
|
@ -109,10 +109,20 @@ func Dashboard(ctx *middleware.Context) {
|
|||
ctx.Data["CollaborativeRepos"] = collaborateRepos
|
||||
}
|
||||
|
||||
repos, err := models.GetRepositories(ctxUser.Id, true)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
var repos []*models.Repository
|
||||
if ctxUser.IsOrganization() {
|
||||
if err := ctxUser.GetUserRepositories(ctx.User.Id); err != nil {
|
||||
ctx.Handle(500, "GetUserRepositories", err)
|
||||
return
|
||||
}
|
||||
repos = ctxUser.Repos
|
||||
} else {
|
||||
var err error
|
||||
repos, err = models.GetRepositories(ctxUser.Id, true)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx.Data["Repos"] = repos
|
||||
|
||||
|
@ -120,7 +130,7 @@ func Dashboard(ctx *middleware.Context) {
|
|||
mirrors := make([]*models.Repository, 0, 5)
|
||||
for _, repo := range repos {
|
||||
if repo.IsMirror {
|
||||
if err = repo.GetMirror(); err != nil {
|
||||
if err := repo.GetMirror(); err != nil {
|
||||
ctx.Handle(500, "GetMirror: "+repo.Name, err)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue