mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(catalog): apply filter for text-only threads to rules and description
This commit is contained in:
@@ -26,6 +26,7 @@ const useFeedRows = (columnCount: number, feed: any, isFeedLoaded: boolean, subp
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { address, createdAt, description, rules, shortAddress, suggested, title } = subplebbit || {};
|
const { address, createdAt, description, rules, shortAddress, suggested, title } = subplebbit || {};
|
||||||
const { avatarUrl } = suggested || {};
|
const { avatarUrl } = suggested || {};
|
||||||
|
const { showTextOnlyThreads } = useCatalogFiltersStore();
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isInAllView = isAllView(location.pathname, useParams());
|
const isInAllView = isAllView(location.pathname, useParams());
|
||||||
@@ -35,11 +36,13 @@ const useFeedRows = (columnCount: number, feed: any, isFeedLoaded: boolean, subp
|
|||||||
if (!isFeedLoaded) {
|
if (!isFeedLoaded) {
|
||||||
return []; // prevent rules and description from appearing while feed is loading
|
return []; // prevent rules and description from appearing while feed is loading
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!description && !rules && !isInAllView) {
|
if (!description && !rules && !isInAllView) {
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _feed = [...feed];
|
const _feed = [...feed];
|
||||||
if ((description && description.length > 0) || isInAllView) {
|
if ((description && description.length > 0 && (showTextOnlyThreads || (!showTextOnlyThreads && suggested?.avatarUrl))) || isInAllView) {
|
||||||
_feed.unshift({
|
_feed.unshift({
|
||||||
isDescription: true,
|
isDescription: true,
|
||||||
subplebbitAddress: address,
|
subplebbitAddress: address,
|
||||||
@@ -52,7 +55,7 @@ const useFeedRows = (columnCount: number, feed: any, isFeedLoaded: boolean, subp
|
|||||||
locked: true,
|
locked: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (rules && rules.length > 0) {
|
if (rules && rules.length > 0 && showTextOnlyThreads) {
|
||||||
_feed.unshift({
|
_feed.unshift({
|
||||||
isRules: true,
|
isRules: true,
|
||||||
subplebbitAddress: address,
|
subplebbitAddress: address,
|
||||||
|
|||||||
Reference in New Issue
Block a user