diff options
Diffstat (limited to 'server/models/actor')
-rw-r--r-- | server/models/actor/actor-follow.ts | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/server/models/actor/actor-follow.ts b/server/models/actor/actor-follow.ts index 83c00a22d..3080e02a6 100644 --- a/server/models/actor/actor-follow.ts +++ b/server/models/actor/actor-follow.ts | |||
@@ -19,8 +19,8 @@ import { | |||
19 | UpdatedAt | 19 | UpdatedAt |
20 | } from 'sequelize-typescript' | 20 | } from 'sequelize-typescript' |
21 | import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc' | 21 | import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc' |
22 | import { doesExist } from '@server/helpers/database-utils' | ||
22 | import { getServerActor } from '@server/models/application/application' | 23 | import { getServerActor } from '@server/models/application/application' |
23 | import { VideoModel } from '@server/models/video/video' | ||
24 | import { | 24 | import { |
25 | MActorFollowActorsDefault, | 25 | MActorFollowActorsDefault, |
26 | MActorFollowActorsDefaultSubscription, | 26 | MActorFollowActorsDefaultSubscription, |
@@ -166,14 +166,8 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo | |||
166 | 166 | ||
167 | static isFollowedBy (actorId: number, followerActorId: number) { | 167 | static isFollowedBy (actorId: number, followerActorId: number) { |
168 | const query = 'SELECT 1 FROM "actorFollow" WHERE "actorId" = $followerActorId AND "targetActorId" = $actorId LIMIT 1' | 168 | const query = 'SELECT 1 FROM "actorFollow" WHERE "actorId" = $followerActorId AND "targetActorId" = $actorId LIMIT 1' |
169 | const options = { | ||
170 | type: QueryTypes.SELECT as QueryTypes.SELECT, | ||
171 | bind: { actorId, followerActorId }, | ||
172 | raw: true | ||
173 | } | ||
174 | 169 | ||
175 | return VideoModel.sequelize.query(query, options) | 170 | return doesExist(query, { actorId, followerActorId }) |
176 | .then(results => results.length === 1) | ||
177 | } | 171 | } |
178 | 172 | ||
179 | static loadByActorAndTarget (actorId: number, targetActorId: number, t?: Transaction): Promise<MActorFollowActorsDefault> { | 173 | static loadByActorAndTarget (actorId: number, targetActorId: number, t?: Transaction): Promise<MActorFollowActorsDefault> { |