aboutsummaryrefslogtreecommitdiffstats
path: root/models/system
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-03 12:30:41 +0200
committerGitHub <noreply@github.com>2023-10-03 10:30:41 +0000
commitcc5df266808361c1dd3a1d17cbba712826a93d7e (patch)
treef77c59a61d3dc36f07b5b84596e4a1cde12b55cc /models/system
parent08507e2760638124d75774c29ef37e692a88c02d (diff)
downloadgitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.tar.gz
gitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.zip
Even more `db.DefaultContext` refactor (#27352)
Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'models/system')
-rw-r--r--models/system/notice.go4
-rw-r--r--models/system/notice_test.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/models/system/notice.go b/models/system/notice.go
index b0c0bfb95d..058b78e677 100644
--- a/models/system/notice.go
+++ b/models/system/notice.go
@@ -88,8 +88,8 @@ func RemoveStorageWithNotice(ctx context.Context, bucket storage.ObjectStorage,
}
// CountNotices returns number of notices.
-func CountNotices() int64 {
- count, _ := db.GetEngine(db.DefaultContext).Count(new(Notice))
+func CountNotices(ctx context.Context) int64 {
+ count, _ := db.GetEngine(ctx).Count(new(Notice))
return count
}
diff --git a/models/system/notice_test.go b/models/system/notice_test.go
index 871ffa54ce..e8ce05d332 100644
--- a/models/system/notice_test.go
+++ b/models/system/notice_test.go
@@ -49,7 +49,7 @@ func TestCreateRepositoryNotice(t *testing.T) {
func TestCountNotices(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- assert.Equal(t, int64(3), system.CountNotices())
+ assert.Equal(t, int64(3), system.CountNotices(db.DefaultContext))
}
func TestNotices(t *testing.T) {