aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJames Cleverley-Prance <jpts@users.noreply.github.com>2023-03-16 17:30:42 +0000
committerGitHub <noreply@github.com>2023-03-16 12:30:42 -0500
commit574d8fe6d6675c8aa05e2b75fdbc01c009efd8be (patch)
tree4133aa64d1554bc68bfaba65bbfa591a462897ae /services
parent8d9f8e10b10bf7c19c1609072a8cb144176ee01b (diff)
downloadgitea-574d8fe6d6675c8aa05e2b75fdbc01c009efd8be.tar.gz
gitea-574d8fe6d6675c8aa05e2b75fdbc01c009efd8be.zip
Add absent repounits to create/edit repo API (#23500)
Adds the ability to enable/disable Actions, Packages and Releases from the API, via the Edit and Get Repository API endpoints.
Diffstat (limited to 'services')
-rw-r--r--services/convert/repository.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/convert/repository.go b/services/convert/repository.go
index fc965a9457..a2a8570cc9 100644
--- a/services/convert/repository.go
+++ b/services/convert/repository.go
@@ -100,6 +100,21 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, mode perm.Acc
hasProjects = true
}
+ hasReleases := false
+ if _, err := repo.GetUnit(ctx, unit_model.TypeReleases); err == nil {
+ hasReleases = true
+ }
+
+ hasPackages := false
+ if _, err := repo.GetUnit(ctx, unit_model.TypePackages); err == nil {
+ hasPackages = true
+ }
+
+ hasActions := false
+ if _, err := repo.GetUnit(ctx, unit_model.TypeActions); err == nil {
+ hasActions = true
+ }
+
if err := repo.LoadOwner(ctx); err != nil {
return nil
}
@@ -174,6 +189,9 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, mode perm.Acc
InternalTracker: internalTracker,
HasWiki: hasWiki,
HasProjects: hasProjects,
+ HasReleases: hasReleases,
+ HasPackages: hasPackages,
+ HasActions: hasActions,
ExternalWiki: externalWiki,
HasPullRequests: hasPullRequests,
IgnoreWhitespaceConflicts: ignoreWhitespaceConflicts,