aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 410fd6d3f..00ae58c68 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -143,28 +143,28 @@ export type SummaryOptions = {
143 }) 143 })
144 } 144 }
145 145
146 const channelInclude: Includeable[] = [] 146 const channelActorInclude: Includeable[] = []
147 const accountInclude: Includeable[] = [] 147 const accountActorInclude: Includeable[] = []
148 148
149 if (options.forCount !== true) { 149 if (options.forCount !== true) {
150 accountInclude.push({ 150 accountActorInclude.push({
151 model: ServerModel, 151 model: ServerModel,
152 required: false 152 required: false
153 }) 153 })
154 154
155 accountInclude.push({ 155 accountActorInclude.push({
156 model: ActorImageModel, 156 model: ActorImageModel,
157 as: 'Avatars', 157 as: 'Avatars',
158 required: false 158 required: false
159 }) 159 })
160 160
161 channelInclude.push({ 161 channelActorInclude.push({
162 model: ActorImageModel, 162 model: ActorImageModel,
163 as: 'Avatars', 163 as: 'Avatars',
164 required: false 164 required: false
165 }) 165 })
166 166
167 channelInclude.push({ 167 channelActorInclude.push({
168 model: ActorImageModel, 168 model: ActorImageModel,
169 as: 'Banners', 169 as: 'Banners',
170 required: false 170 required: false
@@ -172,7 +172,7 @@ export type SummaryOptions = {
172 } 172 }
173 173
174 if (options.forCount !== true || serverRequired) { 174 if (options.forCount !== true || serverRequired) {
175 channelInclude.push({ 175 channelActorInclude.push({
176 model: ServerModel, 176 model: ServerModel,
177 duplicating: false, 177 duplicating: false,
178 required: serverRequired, 178 required: serverRequired,
@@ -190,7 +190,7 @@ export type SummaryOptions = {
190 where: { 190 where: {
191 [Op.and]: whereActorAnd 191 [Op.and]: whereActorAnd
192 }, 192 },
193 include: channelInclude 193 include: channelActorInclude
194 }, 194 },
195 { 195 {
196 model: AccountModel.unscoped(), 196 model: AccountModel.unscoped(),
@@ -202,7 +202,7 @@ export type SummaryOptions = {
202 }, 202 },
203 model: ActorModel.unscoped(), 203 model: ActorModel.unscoped(),
204 required: true, 204 required: true,
205 include: accountInclude 205 include: accountActorInclude
206 } 206 }
207 ] 207 ]
208 } 208 }
@@ -605,17 +605,17 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"`
605 } 605 }
606 } 606 }
607 607
608 const scopes: string | ScopeOptions | (string | ScopeOptions)[] = [ ScopeNames.WITH_ACTOR_BANNER ] 608 const findScopes: string | ScopeOptions | (string | ScopeOptions)[] = [ ScopeNames.WITH_ACTOR_BANNER ]
609 609
610 if (options.withStats === true) { 610 if (options.withStats === true) {
611 scopes.push({ 611 findScopes.push({
612 method: [ ScopeNames.WITH_STATS, { daysPrior: 30 } as AvailableWithStatsOptions ] 612 method: [ ScopeNames.WITH_STATS, { daysPrior: 30 } as AvailableWithStatsOptions ]
613 }) 613 })
614 } 614 }
615 615
616 return Promise.all([ 616 return Promise.all([
617 VideoChannelModel.scope(scopes).count(getQuery(true)), 617 VideoChannelModel.unscoped().count(getQuery(true)),
618 VideoChannelModel.scope(scopes).findAll(getQuery(false)) 618 VideoChannelModel.scope(findScopes).findAll(getQuery(false))
619 ]).then(([ total, data ]) => ({ total, data })) 619 ]).then(([ total, data ]) => ({ total, data }))
620 } 620 }
621 621