mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 22:14:42 +01:00
Fix hide-filtered items appearing in boost carousel
This commit is contained in:
parent
cdc19f83b0
commit
33b55c937b
1 changed files with 10 additions and 9 deletions
|
@ -5,7 +5,7 @@ import { useDebouncedCallback } from 'use-debounce';
|
||||||
import { useSnapshot } from 'valtio';
|
import { useSnapshot } from 'valtio';
|
||||||
|
|
||||||
import FilterContext from '../utils/filter-context';
|
import FilterContext from '../utils/filter-context';
|
||||||
import { isFiltered } from '../utils/filters';
|
import { filteredItems, isFiltered } from '../utils/filters';
|
||||||
import states, { statusKey } from '../utils/states';
|
import states, { statusKey } from '../utils/states';
|
||||||
import statusPeek from '../utils/status-peek';
|
import statusPeek from '../utils/status-peek';
|
||||||
import { groupBoosts, groupContext } from '../utils/timeline-utils';
|
import { groupBoosts, groupContext } from '../utils/timeline-utils';
|
||||||
|
@ -496,9 +496,10 @@ function TimelineItem({
|
||||||
}
|
}
|
||||||
const isCarousel = type === 'boosts' || type === 'pinned';
|
const isCarousel = type === 'boosts' || type === 'pinned';
|
||||||
if (items) {
|
if (items) {
|
||||||
|
const fItems = filteredItems(items, filterContext);
|
||||||
if (isCarousel) {
|
if (isCarousel) {
|
||||||
// Here, we don't hide filtered posts, but we sort them last
|
// Here, we don't hide filtered posts, but we sort them last
|
||||||
items.sort((a, b) => {
|
fItems.sort((a, b) => {
|
||||||
// if (a._filtered && !b._filtered) {
|
// if (a._filtered && !b._filtered) {
|
||||||
// return 1;
|
// return 1;
|
||||||
// }
|
// }
|
||||||
|
@ -518,7 +519,7 @@ function TimelineItem({
|
||||||
return (
|
return (
|
||||||
<li key={`timeline-${statusID}`} class="timeline-item-carousel">
|
<li key={`timeline-${statusID}`} class="timeline-item-carousel">
|
||||||
<StatusCarousel title={title} class={`${type}-carousel`}>
|
<StatusCarousel title={title} class={`${type}-carousel`}>
|
||||||
{items.map((item) => {
|
{fItems.map((item) => {
|
||||||
const { id: statusID, reblog, _pinned } = item;
|
const { id: statusID, reblog, _pinned } = item;
|
||||||
const actualStatusID = reblog?.id || statusID;
|
const actualStatusID = reblog?.id || statusID;
|
||||||
const url = instance
|
const url = instance
|
||||||
|
@ -555,11 +556,11 @@ function TimelineItem({
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const manyItems = items.length > 3;
|
const manyItems = fItems.length > 3;
|
||||||
return items.map((item, i) => {
|
return fItems.map((item, i) => {
|
||||||
const { id: statusID, _differentAuthor } = item;
|
const { id: statusID, _differentAuthor } = item;
|
||||||
const url = instance ? `/${instance}/s/${statusID}` : `/s/${statusID}`;
|
const url = instance ? `/${instance}/s/${statusID}` : `/s/${statusID}`;
|
||||||
const isMiddle = i > 0 && i < items.length - 1;
|
const isMiddle = i > 0 && i < fItems.length - 1;
|
||||||
const isSpoiler = item.sensitive && !!item.spoilerText;
|
const isSpoiler = item.sensitive && !!item.spoilerText;
|
||||||
const showCompact =
|
const showCompact =
|
||||||
(!_differentAuthor && isSpoiler && i > 0) ||
|
(!_differentAuthor && isSpoiler && i > 0) ||
|
||||||
|
@ -568,10 +569,10 @@ function TimelineItem({
|
||||||
(type === 'thread' ||
|
(type === 'thread' ||
|
||||||
(type === 'conversation' &&
|
(type === 'conversation' &&
|
||||||
!_differentAuthor &&
|
!_differentAuthor &&
|
||||||
!items[i - 1]._differentAuthor &&
|
!fItems[i - 1]._differentAuthor &&
|
||||||
!items[i + 1]._differentAuthor)));
|
!fItems[i + 1]._differentAuthor)));
|
||||||
const isStart = i === 0;
|
const isStart = i === 0;
|
||||||
const isEnd = i === items.length - 1;
|
const isEnd = i === fItems.length - 1;
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
key={`timeline-${statusID}`}
|
key={`timeline-${statusID}`}
|
||||||
|
|
Loading…
Add table
Reference in a new issue