@ -587,8 +587,15 @@ func retrieveProjects(ctx *context.Context, repo *repo_model.Repository) {
if repo . Owner . IsOrganization ( ) {
repoOwnerType = project_model . TypeOrganization
}
projectsUnit := repo . MustGetUnit ( ctx , unit . TypeProjects )
var openProjects [ ] * project_model . Project
var closedProjects [ ] * project_model . Project
var err error
projects , err := db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
if projectsUnit . ProjectsConfig ( ) . IsProjectsAllowed ( repo_model . ProjectsModeRepo ) {
openProjects , err = db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
ListOptions : db . ListOptionsAll ,
RepoID : repo . ID ,
IsClosed : optional . Some ( false ) ,
@ -598,30 +605,31 @@ func retrieveProjects(ctx *context.Context, repo *repo_model.Repository) {
ctx . ServerError ( "GetProjects" , err )
return
}
projects2 , err : = db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
closedProjects , err = db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
ListOptions : db . ListOptionsAll ,
OwnerID : repo . Owner ID,
IsClosed : optional . Some ( fals e) ,
Type : repoOwnerType ,
RepoID : repo . ID ,
IsClosed : optional . Some ( tru e) ,
Type : project_model . TypeRepository ,
} )
if err != nil {
ctx . ServerError ( "GetProjects" , err )
return
}
}
ctx . Data [ "OpenProjects" ] = append ( projects , projects2 ... )
projects , err = db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
if projectsUnit . ProjectsConfig ( ) . IsProjectsAllowed ( repo_model . ProjectsModeOwner ) {
openProjects2 , err := db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
ListOptions : db . ListOptionsAll ,
RepoID : repo . ID ,
IsClosed : optional . Some ( tru e) ,
Type : project_model . TypeRepository ,
OwnerID : repo . Owner ID,
IsClosed : optional . Some ( fals e) ,
Type : repoOwnerType ,
} )
if err != nil {
ctx . ServerError ( "GetProjects" , err )
return
}
projects2 , err = db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
openProjects = append ( openProjects , openProjects2 ... )
closedProjects2 , err := db . Find [ project_model . Project ] ( ctx , project_model . SearchOptions {
ListOptions : db . ListOptionsAll ,
OwnerID : repo . OwnerID ,
IsClosed : optional . Some ( true ) ,
@ -631,8 +639,11 @@ func retrieveProjects(ctx *context.Context, repo *repo_model.Repository) {
ctx . ServerError ( "GetProjects" , err )
return
}
closedProjects = append ( closedProjects , closedProjects2 ... )
}
ctx . Data [ "ClosedProjects" ] = append ( projects , projects2 ... )
ctx . Data [ "OpenProjects" ] = openProjects
ctx . Data [ "ClosedProjects" ] = closedProjects
}
// repoReviewerSelection items to bee shown