@@ -516,6 +516,50 @@ describe('pds author feed views', () => {
516516 expect ( AppBskyFeedDefs . isReasonPin ( pinnedPost ?. reason ) ) . toBeFalsy ( )
517517 expect ( forSnapshot ( data . feed ) ) . toMatchSnapshot ( )
518518 } )
519+
520+ it ( "cannot pin someone else's post" , async ( ) => {
521+ const bobPost = await sc . post ( bob , 'pinned post' )
522+ await sc . post ( alice , 'not pinned post' )
523+ await network . processAll ( )
524+
525+ const profile = await pdsAgent . com . atproto . repo . getRecord ( {
526+ repo : alice ,
527+ collection : 'app.bsky.actor.profile' ,
528+ rkey : 'self' ,
529+ } )
530+
531+ if ( ! AppBskyActorProfile . isRecord ( profile . data . value ) ) {
532+ throw new Error ( '' )
533+ }
534+
535+ const newProfile : AppBskyActorProfile . Record = {
536+ ...profile ,
537+ pinnedPost : {
538+ uri : bobPost . ref . uriStr ,
539+ cid : bobPost . ref . cid . toString ( ) ,
540+ } ,
541+ }
542+
543+ await sc . updateProfile ( alice , newProfile )
544+
545+ await network . processAll ( )
546+
547+ const { data } = await agent . api . app . bsky . feed . getAuthorFeed (
548+ { actor : sc . accounts [ alice ] . handle } ,
549+ {
550+ headers : await network . serviceHeaders (
551+ alice ,
552+ ids . AppBskyFeedGetAuthorFeed ,
553+ ) ,
554+ } ,
555+ )
556+
557+ const pinnedPost = data . feed . find (
558+ ( item ) => item . post . uri === bobPost . ref . uriStr ,
559+ )
560+ expect ( pinnedPost ) . toBeUndefined ( )
561+ expect ( forSnapshot ( data . feed ) ) . toMatchSnapshot ( )
562+ } )
519563 } )
520564} )
521565
0 commit comments