diff options
-rw-r--r-- | server/models/video/video-channel.ts | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 7d717fc68..e70e52515 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -69,9 +69,9 @@ type AvailableForListOptions = { | |||
69 | 69 | ||
70 | // Only list local channels OR channels that are on an instance followed by actorId | 70 | // Only list local channels OR channels that are on an instance followed by actorId |
71 | const inQueryInstanceFollow = '(' + | 71 | const inQueryInstanceFollow = '(' + |
72 | 'SELECT "actor"."serverId" FROM "actor" ' + | 72 | 'SELECT "actor"."serverId" FROM "actorFollow" ' + |
73 | 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = actor.id ' + | 73 | 'INNER JOIN "actor" ON actor.id= "actorFollow"."targetActorId" ' + |
74 | 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + | 74 | 'WHERE "actor"."id" = ' + actorIdNumber + |
75 | ')' | 75 | ')' |
76 | 76 | ||
77 | return { | 77 | return { |
@@ -253,15 +253,14 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
253 | limit: options.count, | 253 | limit: options.count, |
254 | order: getSort(options.sort), | 254 | order: getSort(options.sort), |
255 | where: { | 255 | where: { |
256 | id: { | 256 | [Sequelize.Op.or]: [ |
257 | [ Sequelize.Op.in ]: Sequelize.literal( | 257 | Sequelize.literal( |
258 | '(' + | 258 | 'lower(immutable_unaccent("VideoChannelModel"."name")) % lower(immutable_unaccent(' + escapedSearch + '))' |
259 | 'SELECT id FROM "videoChannel" WHERE ' + | 259 | ), |
260 | 'lower(immutable_unaccent("name")) % lower(immutable_unaccent(' + escapedSearch + ')) OR ' + | 260 | Sequelize.literal( |
261 | 'lower(immutable_unaccent("name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))' + | 261 | 'lower(immutable_unaccent("VideoChannelModel"."name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))' |
262 | ')' | ||
263 | ) | 262 | ) |
264 | } | 263 | ] |
265 | } | 264 | } |
266 | } | 265 | } |
267 | 266 | ||