summaryrefslogtreecommitdiffstats
path: root/modules/notification/webhook/webhook.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-05-07 18:21:15 +0200
committerGitHub <noreply@github.com>2022-05-07 18:21:15 +0200
commit8adba93498ccdde7edcb54e10f6a3d176c3815c4 (patch)
treee48b5809a0a76ca8c2087d373d00a225b713ebb3 /modules/notification/webhook/webhook.go
parent38d72d40f132df8a6e90063f3e96a80048bf299e (diff)
downloadgitea-8adba93498ccdde7edcb54e10f6a3d176c3815c4.tar.gz
gitea-8adba93498ccdde7edcb54e10f6a3d176c3815c4.zip
Hide private repositories in packages (#19584)
Diffstat (limited to 'modules/notification/webhook/webhook.go')
-rw-r--r--modules/notification/webhook/webhook.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go
index d24440d585..c59e972ed6 100644
--- a/modules/notification/webhook/webhook.go
+++ b/modules/notification/webhook/webhook.go
@@ -872,17 +872,19 @@ func notifyPackage(sender *user_model.User, pd *packages_model.PackageDescriptor
return
}
- org := pd.Owner
- if !org.IsOrganization() {
- org = nil
+ ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.notifyPackage Package: %s[%d]", pd.Package.Name, pd.Package.ID))
+ defer finished()
+
+ apiPackage, err := convert.ToPackage(ctx, pd, sender)
+ if err != nil {
+ log.Error("Error converting package: %v", err)
+ return
}
if err := webhook_services.PrepareWebhooks(pd.Repository, webhook.HookEventPackage, &api.PackagePayload{
- Action: action,
- Repository: convert.ToRepo(pd.Repository, perm.AccessModeNone),
- Package: convert.ToPackage(pd),
- Organization: convert.ToUser(org, nil),
- Sender: convert.ToUser(sender, nil),
+ Action: action,
+ Package: apiPackage,
+ Sender: convert.ToUser(sender, nil),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
}