mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 08:59:31 -05:00
Add allow_rebase_update, default_delete_branch_after_merge to repository api response (#20079)
`PATCH /repos/{owner}/{repo}` API allows users to update `allow_rebase_update`, `default_delete_branch_after_merge`, but `GET /repos/{owner}/{repo}` API does not return these two options, and API users has no other ways to find the state of these two options. This PR add `allow_rebase_update`, `default_delete_branch_after_merge` to repository query api response.
This commit is contained in:
parent
edd945bca3
commit
e49ef56dde
3 changed files with 82 additions and 66 deletions
|
@ -78,6 +78,8 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo
|
||||||
allowRebase := false
|
allowRebase := false
|
||||||
allowRebaseMerge := false
|
allowRebaseMerge := false
|
||||||
allowSquash := false
|
allowSquash := false
|
||||||
|
allowRebaseUpdate := false
|
||||||
|
defaultDeleteBranchAfterMerge := false
|
||||||
defaultMergeStyle := repo_model.MergeStyleMerge
|
defaultMergeStyle := repo_model.MergeStyleMerge
|
||||||
if unit, err := repo.GetUnit(unit_model.TypePullRequests); err == nil {
|
if unit, err := repo.GetUnit(unit_model.TypePullRequests); err == nil {
|
||||||
config := unit.PullRequestsConfig()
|
config := unit.PullRequestsConfig()
|
||||||
|
@ -87,6 +89,8 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo
|
||||||
allowRebase = config.AllowRebase
|
allowRebase = config.AllowRebase
|
||||||
allowRebaseMerge = config.AllowRebaseMerge
|
allowRebaseMerge = config.AllowRebaseMerge
|
||||||
allowSquash = config.AllowSquash
|
allowSquash = config.AllowSquash
|
||||||
|
allowRebaseUpdate = config.AllowRebaseUpdate
|
||||||
|
defaultDeleteBranchAfterMerge = config.DefaultDeleteBranchAfterMerge
|
||||||
defaultMergeStyle = config.GetDefaultMergeStyle()
|
defaultMergeStyle = config.GetDefaultMergeStyle()
|
||||||
}
|
}
|
||||||
hasProjects := false
|
hasProjects := false
|
||||||
|
@ -175,6 +179,8 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo
|
||||||
AllowRebase: allowRebase,
|
AllowRebase: allowRebase,
|
||||||
AllowRebaseMerge: allowRebaseMerge,
|
AllowRebaseMerge: allowRebaseMerge,
|
||||||
AllowSquash: allowSquash,
|
AllowSquash: allowSquash,
|
||||||
|
AllowRebaseUpdate: allowRebaseUpdate,
|
||||||
|
DefaultDeleteBranchAfterMerge: defaultDeleteBranchAfterMerge,
|
||||||
DefaultMergeStyle: string(defaultMergeStyle),
|
DefaultMergeStyle: string(defaultMergeStyle),
|
||||||
AvatarURL: repo.AvatarLink(),
|
AvatarURL: repo.AvatarLink(),
|
||||||
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
|
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
|
||||||
|
|
|
@ -91,6 +91,8 @@ type Repository struct {
|
||||||
AllowRebase bool `json:"allow_rebase"`
|
AllowRebase bool `json:"allow_rebase"`
|
||||||
AllowRebaseMerge bool `json:"allow_rebase_explicit"`
|
AllowRebaseMerge bool `json:"allow_rebase_explicit"`
|
||||||
AllowSquash bool `json:"allow_squash_merge"`
|
AllowSquash bool `json:"allow_squash_merge"`
|
||||||
|
AllowRebaseUpdate bool `json:"allow_rebase_update"`
|
||||||
|
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge"`
|
||||||
DefaultMergeStyle string `json:"default_merge_style"`
|
DefaultMergeStyle string `json:"default_merge_style"`
|
||||||
AvatarURL string `json:"avatar_url"`
|
AvatarURL string `json:"avatar_url"`
|
||||||
Internal bool `json:"internal"`
|
Internal bool `json:"internal"`
|
||||||
|
|
|
@ -17713,6 +17713,10 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "AllowRebaseMerge"
|
"x-go-name": "AllowRebaseMerge"
|
||||||
},
|
},
|
||||||
|
"allow_rebase_update": {
|
||||||
|
"type": "boolean",
|
||||||
|
"x-go-name": "AllowRebaseUpdate"
|
||||||
|
},
|
||||||
"allow_squash_merge": {
|
"allow_squash_merge": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "AllowSquash"
|
"x-go-name": "AllowSquash"
|
||||||
|
@ -17738,6 +17742,10 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "DefaultBranch"
|
"x-go-name": "DefaultBranch"
|
||||||
},
|
},
|
||||||
|
"default_delete_branch_after_merge": {
|
||||||
|
"type": "boolean",
|
||||||
|
"x-go-name": "DefaultDeleteBranchAfterMerge"
|
||||||
|
},
|
||||||
"default_merge_style": {
|
"default_merge_style": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "DefaultMergeStyle"
|
"x-go-name": "DefaultMergeStyle"
|
||||||
|
|
Loading…
Reference in a new issue