aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-playlist.ts21
1 files changed, 6 insertions, 15 deletions
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index ef87a7ee9..71a580249 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -13,11 +13,10 @@ import {
13 Model, 13 Model,
14 Scopes, 14 Scopes,
15 Table, 15 Table,
16 UpdatedAt, 16 UpdatedAt
17 Sequelize
18} from 'sequelize-typescript' 17} from 'sequelize-typescript'
19import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' 18import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
20import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getSort, isOutdated, throwIfNotValid, createSimilarityAttribute } from '../utils' 19import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getSort, isOutdated, throwIfNotValid } from '../utils'
21import { 20import {
22 isVideoPlaylistDescriptionValid, 21 isVideoPlaylistDescriptionValid,
23 isVideoPlaylistNameValid, 22 isVideoPlaylistNameValid,
@@ -46,7 +45,8 @@ import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
46import { FindOptions, literal, Op, ScopeOptions, Transaction, WhereOptions } from 'sequelize' 45import { FindOptions, literal, Op, ScopeOptions, Transaction, WhereOptions } from 'sequelize'
47import * as Bluebird from 'bluebird' 46import * as Bluebird from 'bluebird'
48import { 47import {
49 MVideoPlaylistAccountThumbnail, MVideoPlaylistAP, 48 MVideoPlaylistAccountThumbnail,
49 MVideoPlaylistAP,
50 MVideoPlaylistFormattable, 50 MVideoPlaylistFormattable,
51 MVideoPlaylistFull, 51 MVideoPlaylistFull,
52 MVideoPlaylistFullSummary, 52 MVideoPlaylistFullSummary,
@@ -166,18 +166,9 @@ type AvailableForListOptions = {
166 } 166 }
167 167
168 if (options.search) { 168 if (options.search) {
169 const escapedSearch = VideoPlaylistModel.sequelize.escape(options.search)
170 const escapedLikeSearch = VideoPlaylistModel.sequelize.escape('%' + options.search + '%')
171 whereAnd.push({ 169 whereAnd.push({
172 id: { 170 name: {
173 [ Op.in ]: Sequelize.literal( 171 [ Op.iLike ]: '%' + options.search + '%'
174 '(' +
175 'SELECT "videoPlaylist"."id" FROM "videoPlaylist" ' +
176 'WHERE ' +
177 'lower(immutable_unaccent("videoPlaylist"."name")) % lower(immutable_unaccent(' + escapedSearch + ')) OR ' +
178 'lower(immutable_unaccent("videoPlaylist"."name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))' +
179 ')'
180 )
181 } 172 }
182 }) 173 })
183 } 174 }