aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-20 10:23:19 +0200
committerChocobozzz <me@florianbigard.com>2022-06-20 10:23:19 +0200
commit714e33a7428b71ef98129ce85a4bd64140bcd912 (patch)
tree59bd3e4b359bcd04f4ad97c404246688ccd84e68 /server/models
parentaa2ce188d102ab38452df316d06286040b5d9075 (diff)
parentd47b18079bfe4aed472ddcc0a89302ba85f03a48 (diff)
downloadPeerTube-714e33a7428b71ef98129ce85a4bd64140bcd912.tar.gz
PeerTube-714e33a7428b71ef98129ce85a4bd64140bcd912.tar.zst
PeerTube-714e33a7428b71ef98129ce85a4bd64140bcd912.zip
Merge branch 'release/4.2.0' into develop
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/account-blocklist.ts14
-rw-r--r--server/models/user/user.ts4
-rw-r--r--server/models/video/video-comment.ts4
-rw-r--r--server/models/video/video-playlist.ts4
4 files changed, 20 insertions, 6 deletions
diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.ts
index a7b8db076..377249b38 100644
--- a/server/models/account/account-blocklist.ts
+++ b/server/models/account/account-blocklist.ts
@@ -132,6 +132,20 @@ export class AccountBlocklistModel extends Model<Partial<AttributesOnly<AccountB
132 as: 'BlockedAccount' 132 as: 'BlockedAccount'
133 } 133 }
134 ] 134 ]
135 } else if (search) { // We need some joins when counting with search
136 query.include = [
137 {
138 model: AccountModel.unscoped(),
139 required: true,
140 as: 'BlockedAccount',
141 include: [
142 {
143 model: ActorModel.unscoped(),
144 required: true
145 }
146 ]
147 }
148 ]
135 } 149 }
136 150
137 return query 151 return query
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index 20c2222a7..a25551ecd 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -819,10 +819,10 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
819 } 819 }
820 } 820 }
821 821
822 return UserModel.count(query) 822 return UserModel.unscoped().count(query)
823 } 823 }
824 824
825 const totalUsers = await UserModel.count() 825 const totalUsers = await UserModel.unscoped().count()
826 const totalDailyActiveUsers = await getActiveUsers(1) 826 const totalDailyActiveUsers = await getActiveUsers(1)
827 const totalWeeklyActiveUsers = await getActiveUsers(7) 827 const totalWeeklyActiveUsers = await getActiveUsers(7)
828 const totalMonthlyActiveUsers = await getActiveUsers(30) 828 const totalMonthlyActiveUsers = await getActiveUsers(30)
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 2d60c6a30..1d3178164 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -683,11 +683,11 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment
683 const totalLocalVideoComments = await VideoCommentModel.count({ 683 const totalLocalVideoComments = await VideoCommentModel.count({
684 include: [ 684 include: [
685 { 685 {
686 model: AccountModel, 686 model: AccountModel.unscoped(),
687 required: true, 687 required: true,
688 include: [ 688 include: [
689 { 689 {
690 model: ActorModel, 690 model: ActorModel.unscoped(),
691 required: true, 691 required: true,
692 where: { 692 where: {
693 serverId: null 693 serverId: null
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 8fb3d5f15..00cca0549 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -617,11 +617,11 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
617 const totalLocalPlaylists = await VideoPlaylistModel.count({ 617 const totalLocalPlaylists = await VideoPlaylistModel.count({
618 include: [ 618 include: [
619 { 619 {
620 model: AccountModel, 620 model: AccountModel.unscoped(),
621 required: true, 621 required: true,
622 include: [ 622 include: [
623 { 623 {
624 model: ActorModel, 624 model: ActorModel.unscoped(),
625 required: true, 625 required: true,
626 where: { 626 where: {
627 serverId: null 627 serverId: null