-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pinned posts #2771
Pinned posts #2771
Conversation
f145759
to
456c8f9
Compare
Ah one thing: if you pin a reply, it only shows up in your posts & replies 🤔 |
// @NOTE the feed item types in the protos for author feeds and timelines | ||
// technically have additional fields, not supported by the mock dataplane. | ||
export type FeedItem = { post: ItemRef; repost?: ItemRef } | ||
export type FeedItem = { | ||
post: ItemRef | ||
repost?: ItemRef | ||
/** | ||
* If true, overrides the `reason` with `app.bsky.feed.defs#reasonPin`. Used | ||
* only in author feeds. | ||
*/ | ||
authorPinned?: boolean | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the part I'm least sure about - is it ok to add this extra field here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this type of a bit funny and could honestly probably find a cozier spot. This type is only used as a parameter for both hydration & views. So you should be good to add this extra property here. The lil note is appreciated 👍
const pinnedItem = { | ||
post: { | ||
uri: actor.profile.pinnedPost.uri, | ||
cid: actor.profile.pinnedPost.cid, | ||
}, | ||
repost: undefined, | ||
authorPinned: true, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set authorPinned
here, I'm not expecting the value to come from the dataplane or anything so I imagine it should be fine (but would be good to confirm)
@@ -186,6 +194,10 @@ | |||
"repost": { "type": "string", "format": "at-uri" } | |||
} | |||
}, | |||
"skeletonReasonPin": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually like that this could be used in the future for a feed gen to "pin" a post to the top of a feed
@@ -44,7 +44,8 @@ | |||
"like": { "type": "string", "format": "at-uri" }, | |||
"threadMuted": { "type": "boolean" }, | |||
"replyDisabled": { "type": "boolean" }, | |||
"embeddingDisabled": { "type": "boolean" } | |||
"embeddingDisabled": { "type": "boolean" }, | |||
"pinned": { "type": "boolean" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, does this affect the presentation of a post elsewhere in the app (other than a user's own author feed) when viewing their own pinned post?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it to show "Pin post" or "Unpin post" in the context menu
packages/bsky/src/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
i'll toss a changeset in here and get it merged 👌
@@ -0,0 +1,17 @@ | |||
import { Kysely } from 'kysely' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend isn't using Scylla? What is this kysely about? Just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the Postgres-based reference implementation
Behavior on author feed:
#reasonPin
viewer.pinned
remains the same in either case, and should betrue
Behavior in other feeds:
viewer.pinned
should reflectprofile.pinnedPost