You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Do not store inactive repos (#1658)
Do not sync repos with forge if the repo is not necessary in DB. In the DB, only repos that were active once or repos that are currently active are stored. When trying to enable new repos, the repos list is fetched from the forge instead and displayed directly. In addition to this, the forge func `Perm` was removed and is now merged with `Repo`. Solves a TODO on RepoBatch. --------- Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
@@ -335,30 +335,6 @@ func (g *GitLab) PullRequests(ctx context.Context, u *model.User, r *model.Repo,
|
||||
return result, err
|
||||
}
|
||||
|
||||
// Perm fetches the named repository from the forge.
|
||||
func (g *GitLab) Perm(ctx context.Context, user *model.User, r *model.Repo) (*model.Perm, error) {
|
||||
client, err := newClient(g.URL, user.Token, g.SkipVerify)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
repo, err := g.getProject(ctx, client, r.Owner, r.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// repo owner is granted full access
|
||||
if repo.Owner != nil && repo.Owner.Username == user.Login {
|
||||
return &model.Perm{Push: true, Pull: true, Admin: true}, nil
|
||||
}
|
||||
|
||||
// return permission for current user
|
||||
return &model.Perm{
|
||||
Pull: isRead(repo),
|
||||
Push: isWrite(repo),
|
||||
Admin: isAdmin(repo),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// File fetches a file from the forge repository and returns in string format.
|
||||
func (g *GitLab) File(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, fileName string) ([]byte, error) {
|
||||
client, err := newClient(g.URL, user.Token, g.SkipVerify)
|
||||
|
||||
Reference in New Issue
Block a user