summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorNorwin <noerw@users.noreply.github.com>2022-07-27 13:58:21 +0200
committerGitHub <noreply@github.com>2022-07-27 19:58:21 +0800
commit2ae1675092ebe300ed88397a0eae5ca1b3a5443c (patch)
tree985ab36af394b616ab17cd333ab8d07dcd325fef /routers
parent158f2746b8970c46748604e081bdf1fdd8fa9376 (diff)
downloadgitea-2ae1675092ebe300ed88397a0eae5ca1b3a5443c.tar.gz
gitea-2ae1675092ebe300ed88397a0eae5ca1b3a5443c.zip
Show hint to link package to repo when viewing empty repo package list (#20504)
* show hint to link package to repo on empty repo package listing * reword
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/packages.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/web/repo/packages.go b/routers/web/repo/packages.go
index d2d31ad57c..57db19aa32 100644
--- a/routers/web/repo/packages.go
+++ b/routers/web/repo/packages.go
@@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/packages"
+ "code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
@@ -62,6 +63,9 @@ func Packages(ctx *context.Context) {
ctx.Data["Query"] = query
ctx.Data["PackageType"] = packageType
ctx.Data["HasPackages"] = hasPackages
+ if ctx.Repo != nil {
+ ctx.Data["CanWritePackages"] = ctx.IsUserRepoWriter([]unit.Type{unit.TypePackages}) || ctx.IsUserSiteAdmin()
+ }
ctx.Data["PackageDescriptors"] = pds
ctx.Data["Total"] = total
ctx.Data["RepositoryAccessMap"] = map[int64]bool{ctx.Repo.Repository.ID: true} // There is only the current repository