more formatting fixes

This commit is contained in:
Denys Konovalov 2024-01-21 15:39:55 +01:00
parent 24babd6ca1
commit 58e56cd0c6
No known key found for this signature in database
GPG Key ID: 0037E1B0E33BD2C9
2 changed files with 14 additions and 25 deletions

View File

@ -15,10 +15,7 @@ import (
"code.gitea.io/gitea/services/convert"
)
func innerCreateProject(
ctx *context.APIContext,
projectType project_model.Type,
) {
func innerCreateProject(ctx *context.APIContext, projectType project_model.Type) {
form := web.GetForm(ctx).(*api.NewProjectPayload)
project := &project_model.Project{
RepoID: 0,
@ -290,9 +287,7 @@ func ListUserProjects(ctx *context.APIContext) {
Type: project_model.TypeIndividual,
IsClosed: ctx.FormOptionalBool("closed"),
OwnerID: ctx.Doer.ID,
ListOptions: db.ListOptions{
Page: ctx.FormInt("page"),
},
ListOptions: db.ListOptions{Page: ctx.FormInt("page")},
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "Projects", err)
@ -344,9 +339,7 @@ func ListOrgProjects(ctx *context.APIContext) {
// "$ref": "#/responses/notFound"
projects, count, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
OwnerID: ctx.Org.Organization.AsUser().ID,
ListOptions: db.ListOptions{
Page: ctx.FormInt("page"),
},
ListOptions: db.ListOptions{Page: ctx.FormInt("page")},
IsClosed: ctx.FormOptionalBool("closed"),
Type: project_model.TypeOrganization,
})
@ -407,9 +400,7 @@ func ListRepoProjects(ctx *context.APIContext) {
RepoID: ctx.Repo.Repository.ID,
IsClosed: ctx.FormOptionalBool("closed"),
Type: project_model.TypeRepository,
ListOptions: db.ListOptions{
Page: ctx.FormInt("page"),
},
ListOptions: db.ListOptions{Page: ctx.FormInt("page")},
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "Projects", err)

View File

@ -149,9 +149,7 @@ func TestAPIUpdateProject(t *testing.T) {
token := getUserToken(t, "user2", auth_model.AccessTokenScopeWriteUser, auth_model.AccessTokenScopeWriteIssue)
link, _ := url.Parse(fmt.Sprintf("/api/v1/projects/%d", 1))
req := NewRequestWithJSON(t, "PATCH", link.String(), &api.UpdateProjectPayload{
Title: "First project updated",
}).AddTokenAuth(token)
req := NewRequestWithJSON(t, "PATCH", link.String(), &api.UpdateProjectPayload{Title: "First project updated"}).AddTokenAuth(token)
var apiProject *api.Project