File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -774,7 +774,6 @@ func UpdateRepo(c *gin.Context) {
774774 if ! r .GetAllowPull () && ! r .GetAllowPush () &&
775775 ! r .GetAllowDeploy () && ! r .GetAllowTag () &&
776776 ! r .GetAllowComment () {
777- r .SetAllowPull (true )
778777 r .SetAllowPush (true )
779778 }
780779
@@ -832,6 +831,17 @@ func UpdateRepo(c *gin.Context) {
832831
833832 // if repo has no hook deliveries, skip webhook update
834833 if lastHook .GetWebhookID () != 0 {
834+ // if user is platform admin, fetch the repo owner token to make changes to webhook
835+ if u .GetAdmin () {
836+ u , err = database .FromContext (c ).GetUser (r .GetUserID ())
837+ if err != nil {
838+ retErr := fmt .Errorf ("unable to get repo owner of %s for platform admin webhook update: %w" , r .GetFullName (), err )
839+
840+ util .HandleError (c , http .StatusInternalServerError , retErr )
841+
842+ return
843+ }
844+ }
835845 // update webhook with new events
836846 err = scm .FromContext (c ).Update (u , r , lastHook .GetWebhookID ())
837847 if err != nil {
You can’t perform that action at this time.
0 commit comments