From 4b5d6e6efb09a714d82e2093dec39c85400a2de6 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 27 Sep 2024 22:50:32 +0100 Subject: Pinned posts (#5055) * add to dropdown menu * use normal profile mutation hook * add pin as reason * request pins * shadow update * rm logs * get prev pinned from getProfile * fix toasts * invalidate after appview ready * don't mutate params * rm log * use checkCommited rather than manual whenAppViewReady * move to mutation * even more optimistic optimistic update * allow pins in `posts_and_author_threads` * update @atproto/api * add reasonPin type * fix strange type error in unrelated query * another missing type --- src/lib/api/feed/author.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/lib/api/feed/author.ts') diff --git a/src/lib/api/feed/author.ts b/src/lib/api/feed/author.ts index 56eff1881..50e6a447e 100644 --- a/src/lib/api/feed/author.ts +++ b/src/lib/api/feed/author.ts @@ -8,7 +8,7 @@ import {FeedAPI, FeedAPIResponse} from './types' export class AuthorFeedAPI implements FeedAPI { agent: BskyAgent - params: GetAuthorFeed.QueryParams + _params: GetAuthorFeed.QueryParams constructor({ agent, @@ -18,7 +18,13 @@ export class AuthorFeedAPI implements FeedAPI { feedParams: GetAuthorFeed.QueryParams }) { this.agent = agent - this.params = feedParams + this._params = feedParams + } + + get params() { + const params = {...this._params} + params.includePins = params.filter !== 'posts_with_media' + return params } async peekLatest(): Promise { @@ -57,8 +63,9 @@ export class AuthorFeedAPI implements FeedAPI { return feed.filter(post => { const isReply = post.reply const isRepost = AppBskyFeedDefs.isReasonRepost(post.reason) + const isPin = AppBskyFeedDefs.isReasonPin(post.reason) if (!isReply) return true - if (isRepost) return true + if (isRepost || isPin) return true return isReply && isAuthorReplyChain(this.params.actor, post, feed) }) } -- cgit 1.4.1