Skip to content

Commit 722ac85

Browse files
authored
Merge branch 'OdyseeTeam:master' into speed-up-space
2 parents 09d41e0 + 19b61f2 commit 722ac85

File tree

4 files changed

+42
-38
lines changed

4 files changed

+42
-38
lines changed

ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/contentTab/internal/searchResults.jsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from 'react';
33
import ClaimList from 'component/claimList';
44
import { DEBOUNCE_WAIT_DURATION_MS, SEARCH_OPTIONS } from 'constants/search';
55
import * as CS from 'constants/claim_search';
6+
import * as SETTINGS from 'constants/settings';
67
import { lighthouse } from 'redux/actions/search';
78

89
type Props = {
@@ -11,6 +12,7 @@ type Props = {
1112
showMature: ?boolean,
1213
tileLayout: boolean,
1314
orderBy?: ?string,
15+
hideShorts?: boolean,
1416
minDuration?: ?number,
1517
maxDuration?: ?number,
1618
maxAspectRatio?: ?string | ?number,
@@ -25,6 +27,7 @@ export function SearchResults(props: Props) {
2527
showMature,
2628
tileLayout,
2729
orderBy,
30+
hideShorts,
2831
minDuration,
2932
onResults,
3033
doResolveUris,
@@ -77,7 +80,12 @@ export function SearchResults(props: Props) {
7780
(minDuration ? `&${SEARCH_OPTIONS.MIN_DURATION}=${minDuration}` : '') +
7881
(maxDuration ? `&${SEARCH_OPTIONS.MAX_DURATION}=${maxDuration}` : '') +
7982
`&size=${SEARCH_PAGE_SIZE}` +
80-
(maxAspectRatio ? `&${SEARCH_OPTIONS.MAX_ASPECT_RATIO}=${maxAspectRatio}` : '')
83+
(maxAspectRatio ? `&${SEARCH_OPTIONS.MAX_ASPECT_RATIO}=${maxAspectRatio}` : '') +
84+
(hideShorts ? `&${SEARCH_OPTIONS.EXCLUDE_SHORTS}=${'true'}` : '') +
85+
(hideShorts
86+
? `&${SEARCH_OPTIONS.EXCLUDE_SHORTS_ASPECT_RATIO_LTE}=${SETTINGS.SHORTS_ASPECT_RATIO_LTE}`
87+
: '') +
88+
(hideShorts ? `&${SEARCH_OPTIONS.EXCLUDE_SHORTS_DURATION_LTE}=${SETTINGS.SHORTS_DURATION_LTE}` : '')
8189
)
8290
.then(({ body: results }) => {
8391
const urls = results.map(({ name, claimId }) => {
@@ -105,7 +113,18 @@ export function SearchResults(props: Props) {
105113
}, DEBOUNCE_WAIT_DURATION_MS);
106114

107115
return () => clearTimeout(timer);
108-
}, [searchQuery, claimId, page, showMature, doResolveUris, sortBy, minDuration, maxDuration, maxAspectRatio]);
116+
}, [
117+
searchQuery,
118+
claimId,
119+
page,
120+
showMature,
121+
doResolveUris,
122+
sortBy,
123+
minDuration,
124+
maxDuration,
125+
maxAspectRatio,
126+
hideShorts,
127+
]);
109128

110129
if (!searchResults) {
111130
return null;

ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/contentTab/view.jsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,14 @@ function ContentTab(props: Props) {
199199
infiniteScroll={defaultInfiniteScroll}
200200
isShortFromChannelPage={shortsOnly}
201201
excludeShortsAspectRatio={excludeShorts}
202-
{...(shortsOnly ? {
203-
duration: '<=180',
204-
contentType: CS.FILE_VIDEO,
205-
contentAspectRatio: '<.95',
206-
sectionTitle: 'Shorts',
207-
} : {})}
202+
{...(shortsOnly
203+
? {
204+
duration: `<=${SETTINGS.SHORTS_DURATION_LIMIT}`,
205+
contentType: CS.FILE_VIDEO,
206+
contentAspectRatio: `<${SETTINGS.SHORTS_ASPECT_RATIO_LTE}`,
207+
sectionTitle: 'Shorts',
208+
}
209+
: {})}
208210
loadedCallback={shortsOnly && searchQuery.length > 0 ? undefined : loadedCallback}
209211
meta={
210212
showFilters && (
@@ -237,13 +239,15 @@ function ContentTab(props: Props) {
237239
showMature={showMature}
238240
tileLayout={tileLayout}
239241
orderBy={orderBy}
240-
minDuration={hideShorts ? SETTINGS.SHORTS_DURATION_LIMIT : undefined}
242+
hideShorts={hideShorts}
241243
onResults={(results) => setIsSearching(results !== null)}
242244
doResolveUris={doResolveUris}
243-
{...(shortsOnly ? {
244-
maxDuration: SETTINGS.SHORTS_DURATION_LIMIT,
245-
maxAspectRatio: 0.9999,
246-
} : {})}
245+
{...(shortsOnly
246+
? {
247+
maxDuration: SETTINGS.SHORTS_DURATION_LIMIT,
248+
maxAspectRatio: 0.9999,
249+
}
250+
: {})}
247251
/>
248252
}
249253
isChannel

ui/scss/component/_media.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
background-size: cover;
1313
}
1414

15-
.media__thumb__short{
15+
.media__thumb__short {
1616
aspect-ratio: 9 / 16;
1717
}
1818

@@ -125,6 +125,7 @@
125125
}
126126

127127
.mediaInfo__description {
128+
word-break: break-all;
128129
.claim__tags {
129130
.tag {
130131
background-color: rgba(var(--color-header-button-base), 1);

ui/util/query-params.js

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const getSearchQueryString = (query: string, options: any = {}) => {
4444
const { isBackgroundSearch } = options;
4545
const includeUserOptions = typeof isBackgroundSearch === 'undefined' ? false : !isBackgroundSearch;
4646

47-
let isCustomDurationSet = false;
4847
let isDurationFilterSupported = false;
4948

5049
function checkQuerySupportsDurationFilter() {
@@ -109,14 +108,12 @@ export const getSearchQueryString = (query: string, options: any = {}) => {
109108
if (isDurationFilterSupported && minDuration && minDuration > 0) {
110109
const minSeconds = minDuration * 60;
111110
queryParams.push(`${SEARCH_OPTIONS.MIN_DURATION}=${minSeconds}`);
112-
isCustomDurationSet = true;
113111
}
114112

115113
const maxDuration = options[SEARCH_OPTIONS.MAX_DURATION];
116114
if (isDurationFilterSupported && maxDuration && maxDuration > 0) {
117115
const maxSeconds = maxDuration * 60;
118116
queryParams.push(`${SEARCH_OPTIONS.MAX_DURATION}=${maxSeconds}`);
119-
isCustomDurationSet = true;
120117
}
121118
}
122119

@@ -132,9 +129,6 @@ export const getSearchQueryString = (query: string, options: any = {}) => {
132129
deboost_same_creator,
133130
content_aspect_ratio,
134131
content_aspect_ratio_or_missing,
135-
exclude_shorts,
136-
// exclude_shorts_aspect_ratio_lte,
137-
// exclude_shorts_duration_lte,
138132
} = options;
139133

140134
const { store } = window;
@@ -181,24 +175,10 @@ export const getSearchQueryString = (query: string, options: any = {}) => {
181175
additionalOptions[SEARCH_OPTIONS.CONTENT_ASPECT_RATIO_OR_MISSING] = content_aspect_ratio_or_missing;
182176
}
183177

184-
if (exclude_shorts) {
185-
additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS] = exclude_shorts;
186-
}
187-
188-
// if (hideShorts) {
189-
// additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS] = exclude_shorts;
190-
// }
191-
192-
// if (exclude_shorts_aspect_ratio_lte) {
193-
// additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS_ASPECT_RATIO_LTE] = exclude_shorts_aspect_ratio_lte;
194-
// }
195-
196-
// if (exclude_shorts_duration_lte) {
197-
// additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS_DURATION_LTE] = exclude_shorts_duration_lte;
198-
// }
199-
200-
if (hideShorts && isDurationFilterSupported && !isCustomDurationSet) {
201-
additionalOptions[SEARCH_OPTIONS.MIN_DURATION] = SETTINGS.SHORTS_DURATION_LIMIT;
178+
if (hideShorts) {
179+
additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS] = hideShorts;
180+
additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS_ASPECT_RATIO_LTE] = SETTINGS.SHORTS_ASPECT_RATIO_LTE;
181+
additionalOptions[SEARCH_OPTIONS.EXCLUDE_SHORTS_DURATION_LTE] = SETTINGS.SHORTS_DURATION_LTE;
202182
}
203183

204184
if (additionalOptions) {

0 commit comments

Comments
 (0)