Filter out pinned posts from feed previews

This commit is contained in:
Eric Bailey
2025-04-07 11:06:28 -05:00
parent 57ee0f61c2
commit 8da7e0ad8c
+42 -13
View File
@@ -34,6 +34,30 @@ const RQKEY_ROOT = 'feed-previews'
const RQKEY = (feeds: string[]) => [RQKEY_ROOT, feeds] const RQKEY = (feeds: string[]) => [RQKEY_ROOT, feeds]
const LIMIT = 8 // sliced to 6, overfetch to account for moderation const LIMIT = 8 // sliced to 6, overfetch to account for moderation
const PINNED_POST_URIS = [
// 📰 News
'at://did:plc:kkf4naxqmweop7dv4l2iqqf5/app.bsky.feed.post/3lgh27w2ngc2b',
// Gardening
'at://did:plc:5rw2on4i56btlcajojaxwcat/app.bsky.feed.post/3kjorckgcwc27',
// Web Development Trending
'at://did:plc:m2sjv3wncvsasdapla35hzwj/app.bsky.feed.post/3lfaw445axs22',
// Anime & Manga EN
'at://did:plc:tazrmeme4dzahimsykusrwrk/app.bsky.feed.post/3knxx2gmkns2y',
// 📽️ Film
'at://did:plc:2hwwem55ce6djnk6bn62cstr/app.bsky.feed.post/3llhpzhbq7c2g',
// PopSky
'at://did:plc:lfdf4srj43iwdng7jn35tjsp/app.bsky.feed.post/3lbblgly65c2g',
// Science
'at://did:plc:hu2obebw3nhfj667522dahfg/app.bsky.feed.post/3kl33otd6ob2s',
// Birds! 🦉
'at://did:plc:ffkgesg3jsv2j7aagkzrtcvt/app.bsky.feed.post/3lbg4r57yk22d',
// Astronomy
'at://did:plc:xy2zorw2ys47poflotxthlzg/app.bsky.feed.post/3kyzye4lujs2w',
// What's Cooking 🍽️
'at://did:plc:geoqe3qls5mwezckxxsewys2/app.bsky.feed.post/3lfqhgvxbqc2q',
// BookSky 💙📚 #booksky
'at://did:plc:geoqe3qls5mwezckxxsewys2/app.bsky.feed.post/3kgrm2rw5ww2e',
]
export type FeedPreviewItem = export type FeedPreviewItem =
| { | {
@@ -181,19 +205,24 @@ export function useFeedPreviews(
feedContext: item.feedContext, feedContext: item.feedContext,
reason: item.reason, reason: item.reason,
feedPostUri: item.feedPostUri, feedPostUri: item.feedPostUri,
items: item.items.slice(0, 6).map((subItem, i) => { items: item.items
const feedPostSliceItem: FeedPostSliceItem = { .slice(0, 6)
_reactKey: `${item._reactKey}-${i}-${subItem.post.uri}`, .filter(subItem => {
uri: subItem.post.uri, return !PINNED_POST_URIS.includes(subItem.post.uri)
post: subItem.post, })
record: subItem.record, .map((subItem, i) => {
moderation: moderations[i], const feedPostSliceItem: FeedPostSliceItem = {
parentAuthor: subItem.parentAuthor, _reactKey: `${item._reactKey}-${i}-${subItem.post.uri}`,
isParentBlocked: subItem.isParentBlocked, uri: subItem.post.uri,
isParentNotFound: subItem.isParentNotFound, post: subItem.post,
} record: subItem.record,
return feedPostSliceItem moderation: moderations[i],
}), parentAuthor: subItem.parentAuthor,
isParentBlocked: subItem.isParentBlocked,
isParentNotFound: subItem.isParentNotFound,
}
return feedPostSliceItem
}),
} }
if (slice.isIncompleteThread && slice.items.length >= 3) { if (slice.isIncompleteThread && slice.items.length >= 3) {
const beforeLast = slice.items.length - 2 const beforeLast = slice.items.length - 2