[F3] resolve

(cherry picked from commit 2acd211536)
(cherry picked from commit 704317c24e)
(cherry picked from commit b127296da6)
(cherry picked from commit 000b6f823e)
(cherry picked from commit 7bd1b35139)
(cherry picked from commit 6ba434bf2f)
(cherry picked from commit 5c0826c529)
This commit is contained in:
Earl Warren 2023-10-16 20:33:44 +02:00
parent 8cb9c266ab
commit 00f7d12512
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
8 changed files with 11 additions and 13 deletions

2
go.mod
View file

@ -118,7 +118,7 @@ require (
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/ini.v1 v1.67.0 gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20230917111322-4e5634530d7b lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20231016193607-59f139e6759e
mvdan.cc/xurls/v2 v2.5.0 mvdan.cc/xurls/v2 v2.5.0
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
xorm.io/builder v0.3.13 xorm.io/builder v0.3.13

4
go.sum
View file

@ -1597,8 +1597,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20230917111322-4e5634530d7b h1:ws6llA9HwUA2ofK//7Y/HkV2oaP60M120FFBsHI0G78= lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20231016193607-59f139e6759e h1:xLOCDcDRZ7VwOqdC0NxA+OdUq2X2piHahNylwkF2uN8=
lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20230917111322-4e5634530d7b/go.mod h1:TcKaEsgVihjAjw290iDvvirCT0P+DZNpzc0ZgNgy3E4= lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20231016193607-59f139e6759e/go.mod h1:gbekmufZ+PvotlQUCw9OpcMYo4igaWDjyT70FyNGFwc=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=

View file

@ -1291,7 +1291,7 @@ func oAuth2GothUserToUser(ctx go_context.Context, authSource *auth.Source, gothU
ExternalID: gothUser.UserID, ExternalID: gothUser.UserID,
LoginSourceID: authSource.ID, LoginSourceID: authSource.ID,
} }
hasUser, err = user_model.GetExternalLogin(request.Context(), externalLoginUser) hasUser, err = user_model.GetExternalLogin(ctx, externalLoginUser)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -10,7 +10,6 @@ import (
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
issues_model "code.gitea.io/gitea/models/issues" issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/timeutil"
"lab.forgefriends.org/friendlyforgeformat/gof3/format" "lab.forgefriends.org/friendlyforgeformat/gof3/format"
@ -133,16 +132,15 @@ func (o *MilestoneProvider) FromFormat(ctx context.Context, m *format.Milestone)
} }
func (o *MilestoneProvider) GetObjects(ctx context.Context, user *User, project *Project, page int) []*Milestone { func (o *MilestoneProvider) GetObjects(ctx context.Context, user *User, project *Project, page int) []*Milestone {
milestones, _, err := issues_model.GetMilestones(issues_model.GetMilestonesOption{ milestones, err := db.Find[issues_model.Milestone](ctx, issues_model.FindMilestoneOptions{
ListOptions: db.ListOptions{Page: page, PageSize: o.g.perPage}, ListOptions: db.ListOptions{Page: page, PageSize: o.g.perPage},
RepoID: project.GetID(), RepoID: project.GetID(),
State: api.StateAll,
}) })
if err != nil { if err != nil {
panic(fmt.Errorf("error while listing milestones: %v", err)) panic(fmt.Errorf("error while listing milestones: %v", err))
} }
r := util.ConvertMap[*issues_model.Milestone, *Milestone](([]*issues_model.Milestone)(milestones), MilestoneConverter) r := util.ConvertMap[*issues_model.Milestone, *Milestone](milestones, MilestoneConverter)
if o.project != nil { if o.project != nil {
o.project.milestones = util.NewNameIDMap[*Milestone](r) o.project.milestones = util.NewNameIDMap[*Milestone](r)
} }

View file

@ -100,7 +100,7 @@ func (o *ProjectProvider) FromFormat(ctx context.Context, p *format.Project) *Pr
} }
func (o *ProjectProvider) GetObjects(ctx context.Context, user *User, page int) []*Project { func (o *ProjectProvider) GetObjects(ctx context.Context, user *User, page int) []*Project {
repoList, _, err := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{ repoList, _, err := repo_model.GetUserRepositories(ctx, &repo_model.SearchRepoOptions{
ListOptions: db.ListOptions{Page: page, PageSize: o.g.perPage}, ListOptions: db.ListOptions{Page: page, PageSize: o.g.perPage},
Actor: &user.User, Actor: &user.User,
Private: true, Private: true,
@ -123,7 +123,7 @@ func (o *ProjectProvider) Get(ctx context.Context, user *User, exemplar *Project
if exemplar.GetID() > 0 { if exemplar.GetID() > 0 {
project, err = repo_model.GetRepositoryByID(ctx, exemplar.GetID()) project, err = repo_model.GetRepositoryByID(ctx, exemplar.GetID())
} else if exemplar.Name != "" { } else if exemplar.Name != "" {
project, err = repo_model.GetRepositoryByName(user.GetID(), exemplar.Name) project, err = repo_model.GetRepositoryByName(ctx, user.GetID(), exemplar.Name)
} else { } else {
panic("GetID() == 0 and ProjectName == \"\"") panic("GetID() == 0 and ProjectName == \"\"")
} }

View file

@ -188,7 +188,7 @@ func (o *ReleaseProvider) Put(ctx context.Context, user *User, project *Project,
func (o *ReleaseProvider) Delete(ctx context.Context, user *User, project *Project, release *Release) *Release { func (o *ReleaseProvider) Delete(ctx context.Context, user *User, project *Project, release *Release) *Release {
m := o.Get(ctx, user, project, release) m := o.Get(ctx, user, project, release)
if !m.IsNil() { if !m.IsNil() {
if err := release_service.DeleteReleaseByID(ctx, release.GetID(), o.g.GetDoer(), false); err != nil { if err := release_service.DeleteReleaseByID(ctx, &project.Repository, &release.Release, o.g.GetDoer(), false); err != nil {
panic(err) panic(err)
} }
} }

View file

@ -92,7 +92,7 @@ func getF3UserToPromote(ctx context.Context, source *auth_model.Source, loginNam
return nil, nil return nil, nil
} }
userSource, err := auth_model.GetSourceByID(u.LoginSource) userSource, err := auth_model.GetSourceByID(ctx, u.LoginSource)
if err != nil { if err != nil {
if auth_model.IsErrSourceNotExist(err) { if auth_model.IsErrSourceNotExist(err) {
log.Error("getF3UserToPromote: source id = %v for user %v not found %v", u.LoginSource, u.ID, err) log.Error("getF3UserToPromote: source id = %v for user %v not found %v", u.LoginSource, u.ID, err)

View file

@ -278,7 +278,7 @@ func authSourcePayloadGitLabCustom(name string) map[string]string {
} }
func createF3AuthSource(t *testing.T, name, url, matchingSource string) *auth.Source { func createF3AuthSource(t *testing.T, name, url, matchingSource string) *auth.Source {
assert.NoError(t, auth.CreateSource(&auth.Source{ assert.NoError(t, auth.CreateSource(context.Background(), &auth.Source{
Type: auth.F3, Type: auth.F3,
Name: name, Name: name,
IsActive: true, IsActive: true,