fix(api/v2): keep include_public out of the team body schema

include_public is a list-time query flag, not a team field. With json:"include_public" it leaked into the v2 Team request/response body schema (POST/PUT). Mark it json:"-" so it only travels as a query parameter: v1 binds it via the query tag, and the v2 list handler takes it as a dedicated query field and sets it on the model internally.
This commit is contained in:
kolaente 2026-06-03 20:19:58 +02:00 committed by kolaente
parent 3233dff545
commit dd32e3e496
1 changed files with 5 additions and 2 deletions

View File

@ -57,8 +57,11 @@ type Team struct {
// Defines wether the team should be publicly discoverable when sharing a project
IsPublic bool `xorm:"not null default false" json:"is_public" doc:"Whether the team should be publicly discoverable when sharing a project. Only effective if public teams are enabled on the instance."`
// Query parameter controlling whether to include public projects or not
IncludePublic bool `xorm:"-" query:"include_public" json:"include_public" doc:"When listing teams, also include public teams the user is not a member of. Only honored when public teams are enabled on the instance."`
// Query-only flag controlling whether public teams the user is not a member
// of are included when listing. It is never part of the request or response
// body (json:"-") — v1 binds it from the query string via the query tag, and
// the v2 list handler takes it as a dedicated query field and sets it here.
IncludePublic bool `xorm:"-" query:"include_public" json:"-"`
web.CRUDable `xorm:"-" json:"-"`
web.Permissions `xorm:"-" json:"-"`