diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-05-07 18:21:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-07 18:21:15 +0200 |
commit | 8adba93498ccdde7edcb54e10f6a3d176c3815c4 (patch) | |
tree | e48b5809a0a76ca8c2087d373d00a225b713ebb3 /templates/package | |
parent | 38d72d40f132df8a6e90063f3e96a80048bf299e (diff) | |
download | gitea-8adba93498ccdde7edcb54e10f6a3d176c3815c4.tar.gz gitea-8adba93498ccdde7edcb54e10f6a3d176c3815c4.zip |
Hide private repositories in packages (#19584)
Diffstat (limited to 'templates/package')
-rw-r--r-- | templates/package/shared/list.tmpl | 4 | ||||
-rw-r--r-- | templates/package/view.tmpl | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl index 0b0f71283b..9e6bf5ce9e 100644 --- a/templates/package/shared/list.tmpl +++ b/templates/package/shared/list.tmpl @@ -30,7 +30,11 @@ </div> <div class="desc issue-item-bottom-row df ac fw my-1"> {{$timeStr := TimeSinceUnix .Version.CreatedUnix $.i18n.Lang}} + {{$hasRepositoryAccess := false}} {{if .Repository}} + {{$hasRepositoryAccess = index $.RepositoryAccessMap .Repository.ID}} + {{end}} + {{if $hasRepositoryAccess}} {{$.i18n.Tr "packages.published_by_in" $timeStr .Creator.HomeLink (.Creator.GetDisplayName | Escape) .Repository.HTMLURL (.Repository.FullName | Escape) | Safe}} {{else}} {{$.i18n.Tr "packages.published_by" $timeStr .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl index bb96da3410..efad9f9b8f 100644 --- a/templates/package/view.tmpl +++ b/templates/package/view.tmpl @@ -10,7 +10,7 @@ </div> <div> {{$timeStr := TimeSinceUnix .PackageDescriptor.Version.CreatedUnix $.i18n.Lang}} - {{if .PackageDescriptor.Repository}} + {{if .HasRepositoryAccess}} {{.i18n.Tr "packages.published_by_in" $timeStr .PackageDescriptor.Creator.HomeLink (.PackageDescriptor.Creator.GetDisplayName | Escape) .PackageDescriptor.Repository.HTMLURL (.PackageDescriptor.Repository.FullName | Escape) | Safe}} {{else}} {{.i18n.Tr "packages.published_by" $timeStr .PackageDescriptor.Creator.HomeLink (.PackageDescriptor.Creator.GetDisplayName | Escape) | Safe}} @@ -35,7 +35,7 @@ <strong>{{.i18n.Tr "packages.details"}}</strong> <div class="ui relaxed list"> <div class="item">{{svg .PackageDescriptor.Package.Type.SVGName 16 "mr-3"}} {{.PackageDescriptor.Package.Type.Name}}</div> - {{if .PackageDescriptor.Repository}} + {{if .HasRepositoryAccess}} <div class="item">{{svg "octicon-repo" 16 "mr-3"}} <a href="{{.PackageDescriptor.Repository.HTMLURL}}">{{.PackageDescriptor.Repository.FullName}}</a></div> {{end}} <div class="item">{{svg "octicon-calendar" 16 "mr-3"}} {{.PackageDescriptor.Version.CreatedUnix.FormatDate}}</div> @@ -76,10 +76,10 @@ {{end}} </div> {{end}} - {{if or .CanWritePackages .PackageDescriptor.Repository}} + {{if or .CanWritePackages .HasRepositoryAccess}} <div class="ui divider"></div> <div class="ui relaxed list"> - {{if .PackageDescriptor.Repository}} + {{if .HasRepositoryAccess}} <div class="item">{{svg "octicon-issue-opened" 16 "mr-3"}} <a href="{{.PackageDescriptor.Repository.HTMLURL}}/issues">{{.i18n.Tr "repo.issues"}}</a></div> {{end}} {{if .CanWritePackages}} |