mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 08:34:30 +01:00 
			
		
		
		
	Backport #33008 by @lunny A repository with no issue will display a random number on activities page. This is caused by wrong usage of `And` and `Or`.  Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		
							parent
							
								
									f27128bf94
								
							
						
					
					
						commit
						c102e344f3
					
				@ -16,6 +16,7 @@ import (
 | 
			
		||||
	"code.gitea.io/gitea/modules/git"
 | 
			
		||||
	"code.gitea.io/gitea/modules/gitrepo"
 | 
			
		||||
 | 
			
		||||
	"xorm.io/builder"
 | 
			
		||||
	"xorm.io/xorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -337,8 +338,10 @@ func newlyCreatedIssues(ctx context.Context, repoID int64, fromTime time.Time) *
 | 
			
		||||
func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
 | 
			
		||||
	sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID).
 | 
			
		||||
		And("issue.is_pull = ?", false).
 | 
			
		||||
		And("issue.created_unix >= ?", fromTime.Unix()).
 | 
			
		||||
		Or("issue.closed_unix >= ?", fromTime.Unix())
 | 
			
		||||
		And(builder.Or(
 | 
			
		||||
			builder.Gte{"issue.created_unix": fromTime.Unix()},
 | 
			
		||||
			builder.Gte{"issue.closed_unix": fromTime.Unix()},
 | 
			
		||||
		))
 | 
			
		||||
 | 
			
		||||
	return sess
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user