From 34df7d2859d4511428aa6842d21373d4fa77d466 Mon Sep 17 00:00:00 2001
From: Thomas Zarebczan <thomas.zarebczan@gmail.com>
Date: Tue, 24 Aug 2021 20:50:55 -0400
Subject: [PATCH] Fix stream type for livestreams

Was picking up collections

+ other tweaks
---
 ui/component/claimListDiscover/view.jsx  | 9 +++++++--
 ui/component/claimTilesDiscover/view.jsx | 1 +
 ui/util/search.js                        | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx
index 42a2557da..987d76183 100644
--- a/ui/component/claimListDiscover/view.jsx
+++ b/ui/component/claimListDiscover/view.jsx
@@ -72,6 +72,7 @@ type Props = {
   liveLivestreamsFirst?: boolean,
   livestreamMap?: { [string]: any },
   hasSource?: boolean,
+  hasNoSource?: boolean,
   limitClaimsPerChannel?: number,
   releaseTime?: string,
   showNoSourceClaims?: boolean,
@@ -133,6 +134,7 @@ function ClaimListDiscover(props: Props) {
     liveLivestreamsFirst,
     livestreamMap,
     hasSource,
+    hasNoSource,
     isChannel = false,
     showNoSourceClaims,
     empty,
@@ -244,7 +246,10 @@ function ClaimListDiscover(props: Props) {
         : CS.ORDER_BY_TOP_VALUE, // Sort by top
   };
 
-  if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === CS.CLAIM_STREAM))) {
+  if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
+    options.has_no_source = true;
+    options.claim_type = ['stream'];
+  } else if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream'))) {
     options.has_source = true;
   }
 
@@ -628,7 +633,7 @@ function ClaimListDiscover(props: Props) {
             liveLivestreamsFirst={liveLivestreamsFirst}
             livestreamMap={livestreamMap}
             searchOptions={options}
-            showNoSourceClaims={showNoSourceClaims}
+            showNoSourceClaims={hasNoSource || showNoSourceClaims}
             empty={empty}
           />
           {loading &&
diff --git a/ui/component/claimTilesDiscover/view.jsx b/ui/component/claimTilesDiscover/view.jsx
index c915aa275..1dce1edff 100644
--- a/ui/component/claimTilesDiscover/view.jsx
+++ b/ui/component/claimTilesDiscover/view.jsx
@@ -203,6 +203,7 @@ function ClaimTilesDiscover(props: Props) {
 
   if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
     options.has_no_source = true;
+    options.claim_type = ['stream'];
   } else if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream'))) {
     options.has_source = true;
   }
diff --git a/ui/util/search.js b/ui/util/search.js
index 3839b4d6f..8feecded1 100644
--- a/ui/util/search.js
+++ b/ui/util/search.js
@@ -34,6 +34,8 @@ export function getLivestreamOnlyOptions(options: any) {
   delete newOptions.has_source;
   delete newOptions.stream_types;
   newOptions.has_no_source = true;
+  newOptions.claim_type = ['stream'];
+  newOptions.page_size = 50;
   return newOptions;
 }