0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 23:33:15 -05:00
forgejo/models/activities
oliverpool 525accfae6 Add container.FilterSlice function (gitea#30339)
Many places have the following logic:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	ids := make(container.Set[int64], len(jobs))
	for _, j := range jobs {
		if j.RunID == 0 {
			continue
		}
		ids.Add(j.RunID)
	}
	return ids.Values()
}
```

this introduces a `container.FilterMapUnique` function, which reduces
the code above to:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	return container.FilterMapUnique(jobs, func(j *ActionRunJob) (int64, bool) {
		return j.RunID, j.RunID != 0
	})
}
```
Conflicts:
models/issues/comment_list.go due to premature refactor in #3116
2024-04-16 11:49:44 +02:00
..
action.go Some performance optimization on dashboard and issues page (#29010) 2024-03-20 08:46:28 +01:00
action_list.go Add container.FilterSlice function (gitea#30339) 2024-04-16 11:49:44 +02:00
action_test.go More db.DefaultContext refactor (#27265) 2023-09-29 12:12:54 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
notification.go [Port] gitea#29930: Move notifications to a standalone file 2024-03-28 14:21:42 +01:00
notification_list.go [Port] gitea#29930: Move notifications to a standalone file 2024-03-28 14:21:42 +01:00
notification_test.go Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
repo_activity.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
statistic.go Add more stats tables (#29730) 2024-03-20 08:46:28 +01:00
user_heatmap.go [CHORE] Remove Microsoft SQL Server Support 2024-04-05 23:37:36 +02:00
user_heatmap_test.go Refactor timeutil package (#28623) 2023-12-28 10:09:57 +00:00