]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix channel search with complete handle
authorChocobozzz <me@florianbigard.com>
Fri, 8 Oct 2021 09:15:06 +0000 (11:15 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 11 Oct 2021 07:37:26 +0000 (09:37 +0200)
server/models/video/video-channel.ts
server/tests/api/search/search-channels.ts

index c04bd4355cb5f4822d7ab309a443240faae63f96..8ccb818b38b111962e378485caa17490e4aa8113 100644 (file)
@@ -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
index 8a01aff90a675c44117b974a406af882ec9179f8..67612537c902810e66e6c0c339ab7c9fbaf9b4c2 100644 (file)
@@ -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)