mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Fix bug filtering issues which have no project (#31337)
Fix #31327 This is a quick patch to fix the bug. Some parameters are using 0, some are using -1. I think it needs a refactor to keep consistent. But that will be another PR.
This commit is contained in:
		@@ -38,6 +38,12 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
 | 
				
			|||||||
		searchOpt.MilestoneIDs = opts.MilestoneIDs
 | 
							searchOpt.MilestoneIDs = opts.MilestoneIDs
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if opts.ProjectID > 0 {
 | 
				
			||||||
 | 
							searchOpt.ProjectID = optional.Some(opts.ProjectID)
 | 
				
			||||||
 | 
						} else if opts.ProjectID == -1 { // FIXME: this is inconsistent from other places
 | 
				
			||||||
 | 
							searchOpt.ProjectID = optional.Some[int64](0) // Those issues with no project(projectid==0)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// See the comment of issues_model.SearchOptions for the reason why we need to convert
 | 
						// See the comment of issues_model.SearchOptions for the reason why we need to convert
 | 
				
			||||||
	convertID := func(id int64) optional.Option[int64] {
 | 
						convertID := func(id int64) optional.Option[int64] {
 | 
				
			||||||
		if id > 0 {
 | 
							if id > 0 {
 | 
				
			||||||
@@ -49,7 +55,6 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	searchOpt.ProjectID = convertID(opts.ProjectID)
 | 
					 | 
				
			||||||
	searchOpt.ProjectColumnID = convertID(opts.ProjectColumnID)
 | 
						searchOpt.ProjectColumnID = convertID(opts.ProjectColumnID)
 | 
				
			||||||
	searchOpt.PosterID = convertID(opts.PosterID)
 | 
						searchOpt.PosterID = convertID(opts.PosterID)
 | 
				
			||||||
	searchOpt.AssigneeID = convertID(opts.AssigneeID)
 | 
						searchOpt.AssigneeID = convertID(opts.AssigneeID)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user