From 93a1e67f86be299b7337d229a2c15fbda0a0d6e1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 8 Oct 2021 11:15:06 +0200 Subject: Fix channel search with complete handle --- server/models/video/video-channel.ts | 2 +- server/tests/api/search/search-channels.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index c04bd4355..8ccb818b3 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -121,7 +121,7 @@ export type SummaryOptions = { for (const handle of options.handles || []) { const [ preferredUsername, host ] = handle.split('@') - if (!host) { + if (!host || host === WEBSERVER.HOST) { or.push({ '$Actor.preferredUsername$': preferredUsername, '$Actor.serverId$': null diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index 8a01aff90..67612537c 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts @@ -128,6 +128,13 @@ describe('Test channels search', function () { expect(body.data[0].displayName).to.equal('Squall channel') } + { + const body = await command.advancedChannelSearch({ search: { handles: [ 'squall_channel@' + server.host ] } }) + expect(body.total).to.equal(1) + expect(body.data).to.have.lengthOf(1) + expect(body.data[0].displayName).to.equal('Squall channel') + } + { const body = await command.advancedChannelSearch({ search: { handles: [ 'chocobozzz_channel' ] } }) expect(body.total).to.equal(0) -- cgit v1.2.3