Skip to content

Commit

Permalink
Livestreams: fixes related to 'excludedChannelIds' #2936
Browse files Browse the repository at this point in the history
  • Loading branch information
infinite-persistence committed Aug 23, 2023
2 parents bd92ac6 + aa21742 commit 92c0638
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
5 changes: 3 additions & 2 deletions ui/page/home/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ function HomePage(props: Props) {
}
// -- Find livestreams related to the category:
const rowChannelIds = row.options?.channelIds;
const rowExcludedChannelIds = row.options?.excludedChannelIds;
cache[row.id] = {
livestreamUris:
row.id === 'FOLLOWING'
? filterActiveLivestreamUris(subscribedChannelIds, null, al, lv)
? filterActiveLivestreamUris(subscribedChannelIds, rowExcludedChannelIds, al, lv)
: rowChannelIds
? filterActiveLivestreamUris(rowChannelIds, null, al, lv)
? filterActiveLivestreamUris(rowChannelIds, rowExcludedChannelIds, al, lv)
: null,
};
});
Expand Down
7 changes: 4 additions & 3 deletions ui/redux/selectors/livestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ export const selectFilteredActiveLivestreamUris = createCachedSelector(
const activeCreatorLivestream = activeLivestreamByCreatorId[creatorId];

if (activeCreatorLivestream) {
const channelShouldFilter = !channelIds || channelIds.includes(creatorId);
const channelShouldExclude = excludedChannelIds && !excludedChannelIds.includes(creatorId);
const shouldInclude =
(!channelIds || channelIds.includes(creatorId)) &&
(!excludedChannelIds || !excludedChannelIds.includes(creatorId));

if (channelShouldFilter || channelShouldExclude) {
if (shouldInclude) {
filteredLivestreams.push(activeCreatorLivestream);
}
}
Expand Down
17 changes: 0 additions & 17 deletions ui/util/livestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,6 @@ export function filterActiveLivestreamUris(

const filtered: Array<LivestreamActiveClaim> = [];

for (const creatorId in activeLivestreamByCreatorId) {
const activeLivestream = activeLivestreamByCreatorId[creatorId];
if (activeLivestream) {
if (channelIds) {
if (channelIds.includes(creatorId)) {
if (excludedChannelIds && !excludedChannelIds.includes(creatorId)) {
filtered.push(activeLivestream);
}
}
} else {
if (excludedChannelIds && !excludedChannelIds.includes(creatorId)) {
filtered.push(activeLivestream);
}
}
}
}

for (const creatorId in activeLivestreamByCreatorId) {
const activeLivestream = activeLivestreamByCreatorId[creatorId];
if (activeLivestream) {
Expand Down

0 comments on commit 92c0638

Please sign in to comment.