Remove replies from the home feed (#259)
* Remove replies from the home feed (close #252) * Increase the 'load more' threshholdzio/stable
parent
b1fa1b633f
commit
c2bfa111ac
|
@ -239,22 +239,33 @@ export class FeedModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get nonReplyFeed() {
|
get nonReplyFeed() {
|
||||||
const nonReplyFeed = this.feed.filter(item => {
|
if (this.feedType === 'author') {
|
||||||
const params = this.params as GetAuthorFeed.QueryParams
|
return this.feed.filter(item => {
|
||||||
const isRepost =
|
const params = this.params as GetAuthorFeed.QueryParams
|
||||||
item.reply &&
|
const isRepost =
|
||||||
(item?.reasonRepost?.by?.handle === params.author ||
|
item.reply &&
|
||||||
item?.reasonRepost?.by?.did === params.author)
|
(item?.reasonRepost?.by?.handle === params.author ||
|
||||||
|
item?.reasonRepost?.by?.did === params.author)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
!item.reply || // not a reply
|
!item.reply || // not a reply
|
||||||
isRepost ||
|
isRepost ||
|
||||||
((item._isThreadParent || // but allow if it's a thread by the user
|
((item._isThreadParent || // but allow if it's a thread by the user
|
||||||
item._isThreadChild) &&
|
item._isThreadChild) &&
|
||||||
item.reply?.root.author.did === item.post.author.did)
|
item.reply?.root.author.did === item.post.author.did)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
return nonReplyFeed
|
} else {
|
||||||
|
return this.feed.filter(item => {
|
||||||
|
const isRepost = Boolean(item?.reasonRepost)
|
||||||
|
return (
|
||||||
|
!item.reply || // not a reply
|
||||||
|
isRepost || // but allow if it's a repost or thread
|
||||||
|
item._isThreadParent ||
|
||||||
|
item._isThreadChild
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setHasNewLatest(v: boolean) {
|
setHasNewLatest(v: boolean) {
|
||||||
|
@ -423,6 +434,10 @@ export class FeedModel {
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (item.reply) {
|
||||||
|
// TEMPORARY ignore replies
|
||||||
|
return
|
||||||
|
}
|
||||||
if (AppBskyFeedFeedViewPost.isReasonRepost(item.reason)) {
|
if (AppBskyFeedFeedViewPost.isReasonRepost(item.reason)) {
|
||||||
if (item.reason.by.did === this.rootStore.me.did) {
|
if (item.reason.by.did === this.rootStore.me.did) {
|
||||||
return // ignore reposts by the user
|
return // ignore reposts by the user
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const Feed = observer(function Feed({
|
||||||
if (feed.isEmpty) {
|
if (feed.isEmpty) {
|
||||||
feedItems = feedItems.concat([EMPTY_FEED_ITEM])
|
feedItems = feedItems.concat([EMPTY_FEED_ITEM])
|
||||||
} else {
|
} else {
|
||||||
feedItems = feedItems.concat(feed.feed)
|
feedItems = feedItems.concat(feed.nonReplyFeed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return feedItems
|
return feedItems
|
||||||
|
@ -69,7 +69,7 @@ export const Feed = observer(function Feed({
|
||||||
feed.hasError,
|
feed.hasError,
|
||||||
feed.hasLoaded,
|
feed.hasLoaded,
|
||||||
feed.isEmpty,
|
feed.isEmpty,
|
||||||
feed.feed,
|
feed.nonReplyFeed,
|
||||||
showWelcomeBanner,
|
showWelcomeBanner,
|
||||||
isNewUser,
|
isNewUser,
|
||||||
])
|
])
|
||||||
|
@ -171,6 +171,7 @@ export const Feed = observer(function Feed({
|
||||||
onScroll={onScroll}
|
onScroll={onScroll}
|
||||||
onRefresh={onRefresh}
|
onRefresh={onRefresh}
|
||||||
onEndReached={onEndReached}
|
onEndReached={onEndReached}
|
||||||
|
onEndReachedThreshold={0.25}
|
||||||
removeClippedSubviews={true}
|
removeClippedSubviews={true}
|
||||||
contentInset={{top: headerOffset}}
|
contentInset={{top: headerOffset}}
|
||||||
contentOffset={{x: 0, y: headerOffset * -1}}
|
contentOffset={{x: 0, y: headerOffset * -1}}
|
||||||
|
|
Loading…
Reference in New Issue