Add collaborative repositories to the dashboard (#2205)

* Add collaborative repositories to the dashboard

Remove some unused code from the Dashboard func

* fix some bug and some refactor

* fix tests
This commit is contained in:
Bwko 2017-08-23 03:30:54 +02:00 committed by Lunny Xiao
parent faf4b503b2
commit 1a5fe4326f
6 changed files with 71 additions and 80 deletions

View file

@ -42,6 +42,7 @@ func Search(ctx *context.APIContext) {
if ctx.IsSigned && opts.OwnerID > 0 {
if ctx.User.ID == opts.OwnerID {
opts.Private = true
opts.Collaborate = true
} else {
u, err := models.GetUserByID(opts.OwnerID)
if err != nil {
@ -54,7 +55,10 @@ func Search(ctx *context.APIContext) {
if u.IsOrganization() && u.IsOwnedBy(ctx.User.ID) {
opts.Private = true
}
// FIXME: how about collaborators?
if !u.IsOrganization() {
opts.Collaborate = true
}
}
}