diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-07 10:11:51 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-07 10:11:51 +0100 |
commit | 11ae7e2917ddf6e3c8e53d0855fd786163112d59 (patch) | |
tree | a0fb395434fb6003889ffcd8eaa4ac94ac5592ad /server/models | |
parent | 0015924ad67d30bbc2d6966427794f5e1143e70f (diff) | |
download | PeerTube-11ae7e2917ddf6e3c8e53d0855fd786163112d59.tar.gz PeerTube-11ae7e2917ddf6e3c8e53d0855fd786163112d59.tar.zst PeerTube-11ae7e2917ddf6e3c8e53d0855fd786163112d59.zip |
Fix follow constraint check with an account
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video/video.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 2ff92cbf1..f3907bed4 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1458,6 +1458,12 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1458 | const query = 'SELECT 1 FROM "videoShare" ' + | 1458 | const query = 'SELECT 1 FROM "videoShare" ' + |
1459 | 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + | 1459 | 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + |
1460 | 'WHERE "actorFollow"."actorId" = $followerActorId AND "actorFollow"."state" = \'accepted\' AND "videoShare"."videoId" = $videoId ' + | 1460 | 'WHERE "actorFollow"."actorId" = $followerActorId AND "actorFollow"."state" = \'accepted\' AND "videoShare"."videoId" = $videoId ' + |
1461 | 'UNION ' + | ||
1462 | 'SELECT 1 FROM "video" ' + | ||
1463 | 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' + | ||
1464 | 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' + | ||
1465 | 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "account"."actorId" ' + | ||
1466 | 'WHERE "actorFollow"."actorId" = $followerActorId AND "actorFollow"."state" = \'accepted\' AND "video"."id" = $videoId ' + | ||
1461 | 'LIMIT 1' | 1467 | 'LIMIT 1' |
1462 | 1468 | ||
1463 | const options = { | 1469 | const options = { |