mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move some repository related code into sub package (#19711)
* Move some repository related code into sub package * Move more repository functions out of models * Fix lint * Some performance optimization for webhooks and others * some refactors * Fix lint * Fix * Update modules/repository/delete.go Co-authored-by: delvh <dev.lh@web.de> * Fix test * Merge * Fix test * Fix test * Fix test * Fix test Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
@@ -266,10 +266,10 @@ func createOrUpdateIssueNotifications(ctx context.Context, issueID, commentID, n
|
||||
|
||||
return err
|
||||
}
|
||||
if issue.IsPull && !checkRepoUnitUser(ctx, issue.Repo, user, unit.TypePullRequests) {
|
||||
if issue.IsPull && !CheckRepoUnitUser(ctx, issue.Repo, user, unit.TypePullRequests) {
|
||||
continue
|
||||
}
|
||||
if !issue.IsPull && !checkRepoUnitUser(ctx, issue.Repo, user, unit.TypeIssues) {
|
||||
if !issue.IsPull && !CheckRepoUnitUser(ctx, issue.Repo, user, unit.TypeIssues) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -510,9 +510,9 @@ func (nl NotificationList) getPendingRepoIDs() []int64 {
|
||||
}
|
||||
|
||||
// LoadRepos loads repositories from database
|
||||
func (nl NotificationList) LoadRepos() (RepositoryList, []int, error) {
|
||||
func (nl NotificationList) LoadRepos() (repo_model.RepositoryList, []int, error) {
|
||||
if len(nl) == 0 {
|
||||
return RepositoryList{}, []int{}, nil
|
||||
return repo_model.RepositoryList{}, []int{}, nil
|
||||
}
|
||||
|
||||
repoIDs := nl.getPendingRepoIDs()
|
||||
@@ -548,7 +548,7 @@ func (nl NotificationList) LoadRepos() (RepositoryList, []int, error) {
|
||||
|
||||
failed := []int{}
|
||||
|
||||
reposList := make(RepositoryList, 0, len(repoIDs))
|
||||
reposList := make(repo_model.RepositoryList, 0, len(repoIDs))
|
||||
for i, notification := range nl {
|
||||
if notification.Repository == nil {
|
||||
notification.Repository = repos[notification.RepoID]
|
||||
|
Reference in New Issue
Block a user