Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Livestreams: fixes related to 'excludedChannelIds' #2936

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/page/discover/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function DiscoverPage(props: Props) {
<LivestreamSection
tileLayout={repostedUri ? false : tileLayout}
channelIds={channelIds}
excludedChannelIds={excludedChannelIds}
excludedChannelIds={isWildWest ? excludedChannelIds : null}
searchLanguages={dynamicRouteProps?.options?.searchLanguages}
langParam={langParam}
hideMembersOnlyContent={hideMembersOnlyContent}
Expand Down
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
Loading