Refactor more filterslice (gitea#30370)
This commit is contained in:
parent
525accfae6
commit
44abf6ab47
3 changed files with 13 additions and 23 deletions
|
@ -197,14 +197,12 @@ func (nl NotificationList) LoadAttributes(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (nl NotificationList) getPendingRepoIDs() []int64 {
|
||||
ids := make(container.Set[int64], len(nl))
|
||||
for _, notification := range nl {
|
||||
if notification.Repository != nil {
|
||||
continue
|
||||
return container.FilterSlice(nl, func(n *Notification) (int64, bool) {
|
||||
if n.Repository != nil {
|
||||
return 0, false
|
||||
}
|
||||
ids.Add(notification.RepoID)
|
||||
}
|
||||
return ids.Values()
|
||||
return n.RepoID, true
|
||||
})
|
||||
}
|
||||
|
||||
// LoadRepos loads repositories from database
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue