feeds := make([]*models.Action, 0, len(actions))
for _, act := range actions {
if act.IsPrivate {
- if has, _ := models.HasAccess(ctx.User, &models.Repository{Id: act.RepoId, IsPrivate: true}, models.ACCESS_MODE_READ); !has {
+ repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
+ // This prevents having to retrieve the repository for each action
+ if act.RepoUserName == ctx.User.LowerName {
+ repo.OwnerId = ctx.User.Id
+ }
+ if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
continue
}
}
if !ctx.IsSigned {
continue
}
- if has, _ := models.HasAccess(ctx.User,
- &models.Repository{
- Id: act.RepoId,
- IsPrivate: true,
- }, models.ACCESS_MODE_READ); !has {
+ repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
+ // This prevents having to retrieve the repository for each action
+ if act.RepoUserName == ctx.User.LowerName {
+ repo.OwnerId = ctx.User.Id
+ }
+ if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
continue
}
}