From: Chocobozzz Date: Tue, 27 Mar 2018 13:09:53 +0000 (+0200) Subject: Add ability to search on domain and username too X-Git-Tag: v1.0.0-beta.2~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3e0c9ff5d5d2a2435fcc25deac3a98223aa7c225;p=oweals%2Fpeertube.git Add ability to search on domain and username too --- diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 3611eca89..a28b5209b 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -676,9 +676,23 @@ export class VideoModel extends Model { limit: count, order: getSort(sort), where: { - name: { - [Sequelize.Op.iLike]: '%' + value + '%' - } + [Sequelize.Op.or]: [ + { + name: { + [ Sequelize.Op.iLike ]: '%' + value + '%' + } + }, + { + preferredUsername: Sequelize.where(Sequelize.col('preferredUsername'), { + [ Sequelize.Op.iLike ]: '%' + value + '%' + }) + }, + { + host: Sequelize.where(Sequelize.col('host'), { + [ Sequelize.Op.iLike ]: '%' + value + '%' + }) + } + ] } }