Make moderation static per item
This commit is contained in:
@@ -157,7 +157,6 @@ const viewabilityConfig = {
|
|||||||
|
|
||||||
type CurrentSource = {
|
type CurrentSource = {
|
||||||
source: string
|
source: string
|
||||||
moderation?: ModerationDecision
|
|
||||||
} | null
|
} | null
|
||||||
|
|
||||||
type VideoItem = {
|
type VideoItem = {
|
||||||
@@ -255,7 +254,7 @@ function Feed() {
|
|||||||
index === currentIndex &&
|
index === currentIndex &&
|
||||||
currentSource?.source === post.embed.playlist
|
currentSource?.source === post.embed.playlist
|
||||||
}
|
}
|
||||||
moderation={currentSource?.moderation}
|
moderation={item.moderation}
|
||||||
scrollGesture={scrollGesture}
|
scrollGesture={scrollGesture}
|
||||||
feedContext={item.feedContext}
|
feedContext={item.feedContext}
|
||||||
/>
|
/>
|
||||||
@@ -287,7 +286,6 @@ function Feed() {
|
|||||||
prevEmbed && AppBskyEmbedVideo.isView(prevEmbed)
|
prevEmbed && AppBskyEmbedVideo.isView(prevEmbed)
|
||||||
? prevEmbed.playlist
|
? prevEmbed.playlist
|
||||||
: null
|
: null
|
||||||
const prevVideoModeration = prevSlice?.moderation
|
|
||||||
const currSlice = videos.at(index)
|
const currSlice = videos.at(index)
|
||||||
const currPost = currSlice?.post
|
const currPost = currSlice?.post
|
||||||
const currEmbed = currPost?.embed
|
const currEmbed = currPost?.embed
|
||||||
@@ -303,7 +301,6 @@ function Feed() {
|
|||||||
nextEmbed && AppBskyEmbedVideo.isView(nextEmbed)
|
nextEmbed && AppBskyEmbedVideo.isView(nextEmbed)
|
||||||
? nextEmbed.playlist
|
? nextEmbed.playlist
|
||||||
: null
|
: null
|
||||||
const nextVideoModeration = nextSlice?.moderation
|
|
||||||
|
|
||||||
const prevPlayerCurrentSource = currentSources[(index + 2) % 3]
|
const prevPlayerCurrentSource = currentSources[(index + 2) % 3]
|
||||||
const currPlayerCurrentSource = currentSources[index % 3]
|
const currPlayerCurrentSource = currentSources[index % 3]
|
||||||
@@ -357,25 +354,16 @@ function Feed() {
|
|||||||
if (prevVideo && prevVideo !== prevPlayerCurrentSource?.source) {
|
if (prevVideo && prevVideo !== prevPlayerCurrentSource?.source) {
|
||||||
currentSources[(index + 2) % 3] = {
|
currentSources[(index + 2) % 3] = {
|
||||||
source: prevVideo,
|
source: prevVideo,
|
||||||
moderation: prevVideoModeration,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currVideo && currVideo !== currPlayerCurrentSource?.source) {
|
if (currVideo && currVideo !== currPlayerCurrentSource?.source) {
|
||||||
// TODO should already been calculated, but just in case
|
|
||||||
// if (!nextVideoModeration && nextPost && moderationOpts) {
|
|
||||||
// nextVideoModeration = moderatePost(nextPost, moderationOpts)
|
|
||||||
// }
|
|
||||||
currentSources[index % 3] = {
|
currentSources[index % 3] = {
|
||||||
source: currVideo,
|
source: currVideo,
|
||||||
moderation: currVideoModeration,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextVideo && nextVideo !== nextPlayerCurrentSource?.source) {
|
if (nextVideo && nextVideo !== nextPlayerCurrentSource?.source) {
|
||||||
currentSources[(index + 1) % 3] = {
|
currentSources[(index + 1) % 3] = {
|
||||||
source: nextVideo,
|
source: nextVideo,
|
||||||
moderation: nextVideoModeration,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,13 +695,7 @@ function Overlay({
|
|||||||
}, [player])
|
}, [player])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hider.Outer
|
<Hider.Outer modui={moderation.ui('contentView')}>
|
||||||
// HACK - Hider.Outer is not reactive, it sets it's initial state
|
|
||||||
// based on the modui but then doesn't update if it changes.
|
|
||||||
// TODO: Better fix - Hider.Outer should be reactive, and modui shouldn't
|
|
||||||
// even be changing here anyway (this overlay is conditional based on moderation) -sfn
|
|
||||||
key={moderation.ui('contentView').blurs[0] ? 'blur' : 'none'}
|
|
||||||
modui={moderation.ui('contentView')}>
|
|
||||||
<Hider.Mask>
|
<Hider.Mask>
|
||||||
<ModerationOverlay embed={embed} onPressShow={onPressShow} />
|
<ModerationOverlay embed={embed} onPressShow={onPressShow} />
|
||||||
</Hider.Mask>
|
</Hider.Mask>
|
||||||
|
|||||||
Reference in New Issue
Block a user