Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support system hook API #14537

Merged
merged 22 commits into from
Jan 28, 2023
Merged

Support system hook API #14537

merged 22 commits into from
Jan 28, 2023

Conversation

lunny
Copy link
Member

@lunny lunny commented Feb 1, 2021

This PR add system hook API.

@lunny lunny added type/enhancement An improvement of existing functionality modifies/api This PR adds API routes or modifies them labels Feb 1, 2021
@lunny lunny changed the title Support system hook API WIP: Support system hook API Feb 1, 2021
@lunny lunny added this to the 1.15.0 milestone Feb 3, 2021
@lunny lunny force-pushed the lunny/system_hook_api branch from 1393a7a to 4c7c494 Compare February 5, 2021 02:15
@noerw noerw added the pr/wip This PR is not ready for review label May 14, 2021
@techknowlogick techknowlogick modified the milestones: 1.15.0, 1.16.0 Jun 15, 2021
@lunny lunny removed this from the 1.16.0 milestone Nov 9, 2021
@lunny lunny changed the title WIP: Support system hook API Support system hook API Dec 12, 2022
@lunny lunny removed the pr/wip This PR is not ready for review label Dec 12, 2022
@lunny lunny added this to the 1.19.0 milestone Dec 12, 2022
@lunny lunny requested review from zeripath, delvh and 6543 December 23, 2022 01:59
@6543
Copy link
Member

6543 commented Jan 3, 2023

please resolve conflicts :)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 3, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2023

Codecov Report

Merging #14537 (a61d04e) into main (151b1a9) will increase coverage by 47.87%.
The diff coverage is 8.73%.

❗ Current head a61d04e differs from pull request most recent head 2635ada. Consider uploading reports for the commit 2635ada to get more accurate results

@@            Coverage Diff            @@
##           main   #14537       +/-   ##
=========================================
+ Coverage      0   47.87%   +47.87%     
=========================================
  Files         0     1056     +1056     
  Lines         0   143662   +143662     
=========================================
+ Hits          0    68778    +68778     
- Misses        0    66626    +66626     
- Partials      0     8258     +8258     
Impacted Files Coverage Δ
models/webhook/webhook.go 77.60% <ø> (ø)
routers/api/v1/admin/hooks.go 0.00% <0.00%> (ø)
routers/api/v1/utils/hook.go 19.92% <0.00%> (ø)
routers/web/admin/hooks.go 0.00% <0.00%> (ø)
routers/web/repo/webhook.go 2.09% <0.00%> (ø)
models/webhook/webhook_system.go 26.00% <26.00%> (ø)
routers/api/v1/api.go 77.10% <100.00%> (ø)
modules/git/last_commit_cache.go 58.06% <0.00%> (ø)
services/org/team_invite.go 50.00% <0.00%> (ø)
... and 1051 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 18, 2023
models/webhook/webhook_system.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 19, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 27, 2023
@6543 6543 merged commit c001597 into go-gitea:main Jan 28, 2023
@@ -0,0 +1,81 @@
// Copyright 2021 The Gitea Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy new year × 2 🎉

Comment on lines +49 to +50
// DeleteDefaultSystemWebhook deletes an admin-configured default or system webhook (where Org and Repo ID both 0)
func DeleteDefaultSystemWebhook(ctx context.Context, id int64) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the Default or the System redundant?

// "$ref": "#/responses/Hook"

hookID := ctx.ParamsInt64(":id")
hook, err := webhook.GetSystemOrDefaultWebhook(ctx, hookID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, there is a difference between system and default hooks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System hooks are run on all repos; default hooks are only copied to new repos. So they can accomplish the same thing, but system hooks are more reliable in that everyone runs the same code, but default hooks are more reliable in that they won't change just because the admin flipped something around.

it seems like you weren't the only one misled by the ambiguity: #23139

@lunny lunny deleted the lunny/system_hook_api branch January 29, 2023 00:10
@lunny lunny removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 31, 2023
@delvh delvh mentioned this pull request Feb 6, 2023
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants