codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

feat(repo): instance defaults for delete-branch-after-merge and allow-maintainer-edit #35

Merged
pat-s merged 5 commits from t3code/b94db11b into v15.0/forgejo-codefloe 2026-05-21 14:05:03 +00:00
Owner

Summary

Adds two instance-wide defaults under [repository.pull-request] in app.ini, for two PR options that previously could only be set per repo:

  • DEFAULT_DELETE_BRANCH_AFTER_MERGE — initial state of "Delete pull request branch after merge" on newly created repositories.
  • DEFAULT_ALLOW_MAINTAINER_EDIT — initial state of "Allow edits from maintainers" on newly created repositories.

Both default to false so behavior is identical to today unless an admin opts in.
The new defaults are applied at the two places a fresh PullRequestsConfig is constructed:

  • repo creation (modules/repository/create.go)
  • API re-enable of the PR unit (routers/api/v1/repo/repo.go), e.g. PATCH /api/v1/repos/{owner}/{repo} flipping has_pull_requests back to true after it was disabled.

Existing repositories with an existing PullRequestsConfig are unaffected.
Per-repo overrides via the web settings UI and the API continue to take precedence over the new instance defaults.

Tests

  • modules/setting/repository_test.go — unit test that the new keys load from INI.
  • tests/integration/repo_create_default_pr_test.go — integration tests for both seeding paths (normal create + API re-enable).
## Summary Adds two instance-wide defaults under `[repository.pull-request]` in `app.ini`, for two PR options that previously could only be set per repo: - `DEFAULT_DELETE_BRANCH_AFTER_MERGE` — initial state of "Delete pull request branch after merge" on newly created repositories. - `DEFAULT_ALLOW_MAINTAINER_EDIT` — initial state of "Allow edits from maintainers" on newly created repositories. Both default to `false` so behavior is identical to today unless an admin opts in. The new defaults are applied at the two places a fresh `PullRequestsConfig` is constructed: - repo creation (`modules/repository/create.go`) - API re-enable of the PR unit (`routers/api/v1/repo/repo.go`), e.g. `PATCH /api/v1/repos/{owner}/{repo}` flipping `has_pull_requests` back to `true` after it was disabled. Existing repositories with an existing `PullRequestsConfig` are unaffected. Per-repo overrides via the web settings UI and the API continue to take precedence over the new instance defaults. ## Tests - `modules/setting/repository_test.go` — unit test that the new keys load from INI. - `tests/integration/repo_create_default_pr_test.go` — integration tests for both seeding paths (normal create + API re-enable).
docs(repo): document DEFAULT_DELETE_BRANCH_AFTER_MERGE and DEFAULT_ALLOW_MAINTAINER_EDIT
Some checks failed
testing / test-unit (pull_request) Has been skipped
testing / test-e2e (pull_request) Has been skipped
testing / security-check (pull_request) Has been skipped
testing / frontend-checks (pull_request) Successful in 2m9s
testing / backend-checks (pull_request) Failing after 11m40s
testing / test-remote-cacher (valkey) (pull_request) Has been skipped
testing / test-mysql (pull_request) Has been skipped
testing / test-sqlite (pull_request) Has been skipped
testing / test-pgsql (pull_request) Has been skipped
testing / test-remote-cacher (redis) (pull_request) Has been skipped
testing / test-remote-cacher (redict) (pull_request) Has been skipped
testing / test-remote-cacher (garnet) (pull_request) Has been skipped
Integration tests for the release process / release-simulation (pull_request) Has been cancelled
ae4103b525
Merge remote-tracking branch 'origin/v15.0/forgejo-codefloe' into t3code/b94db11b
All checks were successful
testing / frontend-checks (pull_request) Successful in 1m26s
testing / test-remote-cacher (garnet) (pull_request) Has been skipped
testing / test-remote-cacher (valkey) (pull_request) Has been skipped
testing / test-remote-cacher (redict) (pull_request) Has been skipped
testing / backend-checks (pull_request) Successful in 13m29s
testing / test-unit (pull_request) Successful in 17m58s
testing / test-remote-cacher (redis) (pull_request) Successful in 5m8s
testing / test-mysql (pull_request) Successful in 30m25s
testing / test-sqlite (pull_request) Successful in 38m33s
testing / test-pgsql (pull_request) Successful in 41m38s
testing / security-check (pull_request) Successful in 3m43s
testing / test-e2e (pull_request) Successful in 27m43s
milestone / set (pull_request_target) Has been skipped
issue-labels / backporting (pull_request_target) Has been skipped
97d8f043ba
pat-s merged commit c8c86b8582 into v15.0/forgejo-codefloe 2026-05-21 14:05:03 +00:00
pat-s deleted branch t3code/b94db11b 2026-05-21 14:05:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!35
No description provided.