Some fixes of the prompt of new branches (#26257)

Related to #26239

This PR makes some fixes:
- do not show the prompt for mirror repos and repos with pull request
units disabled
- use `commit_time` instead of `updated_unix`, as `commit_time` is the
real time when the branch was pushed
This commit is contained in:
Zettat123 2023-08-01 15:25:11 +08:00 committed by GitHub
parent b9baed2c74
commit 9a65d011f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View file

@ -395,9 +395,9 @@ func FindRecentlyPushedNewBranches(ctx context.Context, repoID, userID int64, ex
Where("pusher_id=? AND is_deleted=?", userID, false).
And("name <> ?", excludeBranchName).
And("repo_id = ?", repoID).
And("updated_unix >= ?", time.Now().Add(-time.Hour*6).Unix()).
And("commit_time >= ?", time.Now().Add(-time.Hour*6).Unix()).
NotIn("name", subQuery).
OrderBy("branch.updated_unix DESC").
OrderBy("branch.commit_time DESC").
Limit(2).
Find(&branches)
return branches, err