diff options
Diffstat (limited to 'server/models/activitypub/actor-follow.ts')
-rw-r--r-- | server/models/activitypub/actor-follow.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 58bc63d34..ce6a4e267 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import { difference, values } from 'lodash' | 1 | import { difference, values } from 'lodash' |
3 | import { IncludeOptions, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' | 2 | import { IncludeOptions, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' |
4 | import { | 3 | import { |
@@ -62,7 +61,7 @@ import { ActorModel, unusedActorAttributesForAPI } from './actor' | |||
62 | } | 61 | } |
63 | ] | 62 | ] |
64 | }) | 63 | }) |
65 | export class ActorFollowModel extends Model<ActorFollowModel> { | 64 | export class ActorFollowModel extends Model { |
66 | 65 | ||
67 | @AllowNull(false) | 66 | @AllowNull(false) |
68 | @Column(DataType.ENUM(...values(FOLLOW_STATES))) | 67 | @Column(DataType.ENUM(...values(FOLLOW_STATES))) |
@@ -176,7 +175,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
176 | .then(results => results.length === 1) | 175 | .then(results => results.length === 1) |
177 | } | 176 | } |
178 | 177 | ||
179 | static loadByActorAndTarget (actorId: number, targetActorId: number, t?: Transaction): Bluebird<MActorFollowActorsDefault> { | 178 | static loadByActorAndTarget (actorId: number, targetActorId: number, t?: Transaction): Promise<MActorFollowActorsDefault> { |
180 | const query = { | 179 | const query = { |
181 | where: { | 180 | where: { |
182 | actorId, | 181 | actorId, |
@@ -205,7 +204,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
205 | targetName: string, | 204 | targetName: string, |
206 | targetHost: string, | 205 | targetHost: string, |
207 | t?: Transaction | 206 | t?: Transaction |
208 | ): Bluebird<MActorFollowActorsDefaultSubscription> { | 207 | ): Promise<MActorFollowActorsDefaultSubscription> { |
209 | const actorFollowingPartInclude: IncludeOptions = { | 208 | const actorFollowingPartInclude: IncludeOptions = { |
210 | model: ActorModel, | 209 | model: ActorModel, |
211 | required: true, | 210 | required: true, |
@@ -258,7 +257,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
258 | }) | 257 | }) |
259 | } | 258 | } |
260 | 259 | ||
261 | static listSubscribedIn (actorId: number, targets: { name: string, host?: string }[]): Bluebird<MActorFollowFollowingHost[]> { | 260 | static listSubscribedIn (actorId: number, targets: { name: string, host?: string }[]): Promise<MActorFollowFollowingHost[]> { |
262 | const whereTab = targets | 261 | const whereTab = targets |
263 | .map(t => { | 262 | .map(t => { |
264 | if (t.host) { | 263 | if (t.host) { |
@@ -287,7 +286,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
287 | }) | 286 | }) |
288 | 287 | ||
289 | const query = { | 288 | const query = { |
290 | attributes: [], | 289 | attributes: [ 'id' ], |
291 | where: { | 290 | where: { |
292 | [Op.and]: [ | 291 | [Op.and]: [ |
293 | { | 292 | { |
@@ -671,7 +670,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
671 | 670 | ||
672 | selections.push('COUNT(*) AS "total"') | 671 | selections.push('COUNT(*) AS "total"') |
673 | 672 | ||
674 | const tasks: Bluebird<any>[] = [] | 673 | const tasks: Promise<any>[] = [] |
675 | 674 | ||
676 | for (const selection of selections) { | 675 | for (const selection of selections) { |
677 | let query = 'SELECT ' + selection + ' FROM "actor" ' + | 676 | let query = 'SELECT ' + selection + ' FROM "actor" ' + |