Allow changing global wiki editability via the API

The global wiki editability can be set via the web UI, this patch makes
it possible to set the same thing via the API too. This is accomplished
by adjusting the GET and PATCH handlers of the
`/api/v1/repos/{owner}/{repo}` route.

The first will include the property when checking the repo's settings,
the second allows a repo admin to change the setting too.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2024-04-16 22:51:36 +02:00
parent ada8bfa52f
commit df8e58c5cb
No known key found for this signature in database
5 changed files with 97 additions and 4 deletions

View file

@ -89,6 +89,7 @@ type Repository struct {
HasWiki bool `json:"has_wiki"`
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
WikiBranch string `json:"wiki_branch,omitempty"`
GloballyEditableWiki bool `json:"globally_editable_wiki"`
HasPullRequests bool `json:"has_pull_requests"`
HasProjects bool `json:"has_projects"`
HasReleases bool `json:"has_releases"`
@ -185,6 +186,8 @@ type EditRepoOption struct {
HasWiki *bool `json:"has_wiki,omitempty"`
// set this structure to use external wiki instead of internal
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
// set the globally editable state of the wiki
GloballyEditableWiki *bool `json:"globally_editable_wiki,omitempty"`
// sets the default branch for this repository.
DefaultBranch *string `json:"default_branch,omitempty"`
// sets the branch used for this repository's wiki.