diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-09 15:59:35 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-06-10 14:02:41 +0200 |
commit | f046e2fa5c2af98f378056206ef65347f4b29b8d (patch) | |
tree | c2cffab0541c9fb0c29e02c7011fe74e108274d3 /server | |
parent | 5fb2e2888ce032c638e4b75d07458642f0833e52 (diff) | |
download | PeerTube-f046e2fa5c2af98f378056206ef65347f4b29b8d.tar.gz PeerTube-f046e2fa5c2af98f378056206ef65347f4b29b8d.tar.zst PeerTube-f046e2fa5c2af98f378056206ef65347f4b29b8d.zip |
Fix video follow SQL
Diffstat (limited to 'server')
-rw-r--r-- | server/models/video/video-query-builder.ts | 6 | ||||
-rw-r--r-- | server/models/video/video.ts | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts index 455f9f30f..6211c9e56 100644 --- a/server/models/video/video-query-builder.ts +++ b/server/models/video/video-query-builder.ts | |||
@@ -135,12 +135,14 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions) | |||
135 | ' EXISTS (' + | 135 | ' EXISTS (' + |
136 | ' SELECT 1 FROM "videoShare" ' + | 136 | ' SELECT 1 FROM "videoShare" ' + |
137 | ' INNER JOIN "actorFollow" "actorFollowShare" ON "actorFollowShare"."targetActorId" = "videoShare"."actorId" ' + | 137 | ' INNER JOIN "actorFollow" "actorFollowShare" ON "actorFollowShare"."targetActorId" = "videoShare"."actorId" ' + |
138 | ' AND "actorFollowShare"."actorId" = :followerActorId WHERE "videoShare"."videoId" = "video"."id"' + | 138 | ' AND "actorFollowShare"."actorId" = :followerActorId AND "actorFollowShare"."state" = \'accepted\' ' + |
139 | ' WHERE "videoShare"."videoId" = "video"."id"' + | ||
139 | ' )' + | 140 | ' )' + |
140 | ' OR' + | 141 | ' OR' + |
141 | ' EXISTS (' + | 142 | ' EXISTS (' + |
142 | ' SELECT 1 from "actorFollow" ' + | 143 | ' SELECT 1 from "actorFollow" ' + |
143 | ' WHERE "actorFollow"."targetActorId" = "videoChannel"."actorId" AND "actorFollow"."actorId" = :followerActorId' + | 144 | ' WHERE "actorFollow"."targetActorId" = "videoChannel"."actorId" AND "actorFollow"."actorId" = :followerActorId ' + |
145 | ' AND "actorFollow"."state" = \'accepted\'' + | ||
144 | ' )' | 146 | ' )' |
145 | 147 | ||
146 | if (options.includeLocalVideos) { | 148 | if (options.includeLocalVideos) { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 344bfc929..5aa40220e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1366,7 +1366,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1366 | // Instances only share videos | 1366 | // Instances only share videos |
1367 | const query = 'SELECT 1 FROM "videoShare" ' + | 1367 | const query = 'SELECT 1 FROM "videoShare" ' + |
1368 | 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + | 1368 | 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + |
1369 | 'WHERE "actorFollow"."actorId" = $followerActorId AND "videoShare"."videoId" = $videoId ' + | 1369 | 'WHERE "actorFollow"."actorId" = $followerActorId AND "actorFollow"."state" = \'accepted\' AND "videoShare"."videoId" = $videoId ' + |
1370 | 'LIMIT 1' | 1370 | 'LIMIT 1' |
1371 | 1371 | ||
1372 | const options = { | 1372 | const options = { |