Only show replies in Following if following all involved actors (#4869)
* Only show replies in Following for followed root and grandparent * Remove now-unnecessary check * Simplify conditionzio/stable
parent
7f292abf51
commit
293ac6fab2
|
@ -82,10 +82,6 @@ export class FeedViewPostsSlice {
|
||||||
return AppBskyFeedDefs.isReasonRepost(reason)
|
return AppBskyFeedDefs.isReasonRepost(reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
get includesThreadRoot() {
|
|
||||||
return !this.items[0].reply
|
|
||||||
}
|
|
||||||
|
|
||||||
get likeCount() {
|
get likeCount() {
|
||||||
return this._feedPost.post.likeCount ?? 0
|
return this._feedPost.post.likeCount ?? 0
|
||||||
}
|
}
|
||||||
|
@ -119,20 +115,19 @@ export class FeedViewPostsSlice {
|
||||||
|
|
||||||
isFollowingAllAuthors(userDid: string) {
|
isFollowingAllAuthors(userDid: string) {
|
||||||
const feedPost = this._feedPost
|
const feedPost = this._feedPost
|
||||||
if (feedPost.post.author.did === userDid) {
|
const authors = [feedPost.post.author]
|
||||||
return true
|
if (feedPost.reply) {
|
||||||
|
if (AppBskyFeedDefs.isPostView(feedPost.reply.parent)) {
|
||||||
|
authors.push(feedPost.reply.parent.author)
|
||||||
}
|
}
|
||||||
if (AppBskyFeedDefs.isPostView(feedPost.reply?.parent)) {
|
if (feedPost.reply.grandparentAuthor) {
|
||||||
const parent = feedPost.reply?.parent
|
authors.push(feedPost.reply.grandparentAuthor)
|
||||||
if (parent?.author.did === userDid) {
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
return (
|
if (AppBskyFeedDefs.isPostView(feedPost.reply.root)) {
|
||||||
parent?.author.viewer?.following &&
|
authors.push(feedPost.reply.root.author)
|
||||||
feedPost.post.author.viewer?.following
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return false
|
}
|
||||||
|
return authors.every(a => a.did === userDid || a.viewer?.following)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,21 +299,16 @@ export class FeedTuner {
|
||||||
tuner: FeedTuner,
|
tuner: FeedTuner,
|
||||||
slices: FeedViewPostsSlice[],
|
slices: FeedViewPostsSlice[],
|
||||||
): FeedViewPostsSlice[] => {
|
): FeedViewPostsSlice[] => {
|
||||||
// remove any replies without at least minLikes likes
|
|
||||||
for (let i = slices.length - 1; i >= 0; i--) {
|
for (let i = slices.length - 1; i >= 0; i--) {
|
||||||
const slice = slices[i]
|
const slice = slices[i]
|
||||||
if (slice.isReply) {
|
if (
|
||||||
if (slice.isThread && slice.includesThreadRoot) {
|
slice.isReply &&
|
||||||
continue
|
!slice.isRepost &&
|
||||||
}
|
!slice.isFollowingAllAuthors(userDid)
|
||||||
if (slice.isRepost) {
|
) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (!slice.isFollowingAllAuthors(userDid)) {
|
|
||||||
slices.splice(i, 1)
|
slices.splice(i, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return slices
|
return slices
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue