-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Refactor: move part of updating protected branch logic to service layer #33742
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
Refactor: move part of updating protected branch logic to service layer #33742
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR refactors the protected branch update logic by moving part of it to the service layer, centralizing functionality and reducing redundancy. Key changes include:
- Introducing a new service function (CreateOrUpdateProtectedBranch) in services/pull/protected_branch.go to encapsulate the update and PR recheck logic.
- Updating the web and API route handlers to call the new service function instead of duplicating the branch-check logic.
- Removing redundant inline recheck logic and cleaning up obsolete comments.
Reviewed Changes
File | Description |
---|---|
services/pull/protected_branch.go | New service function for creating or updating protected branches. |
routers/web/repo/setting/protected_branch.go | Updated to use the new service function for protected branch updates. |
routers/api/v1/repo/branch.go | Removed duplicate branch-check logic in favor of the new service. |
services/forms/repo_form.go | Removed extraneous ASCII art comments. |
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
services/pull/protected_branch.go:22
- [nitpick] Consider renaming 'isPlainRule' to 'isRegularRule' for improved clarity on the branch rule type.
isPlainRule := !git_model.IsRuleNameSpecial(protectBranch.RuleName)
* giteaofficial/main: [skip ci] Updated translations via Crowdin Refactor: move part of updating protected branch logic to service layer (go-gitea#33742) Update changelog for v1.23.5 (go-gitea#33797) Email option to embed images as base64 instead of link (go-gitea#32061) Update TypeScript types (go-gitea#33799) Disable vet=off again (go-gitea#33794)
No description provided.