Skip to content
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

only include media posts by post creator #1486

Merged
merged 4 commits into from
Aug 17, 2023

Conversation

estrattonbailey
Copy link
Member

)
feedItemsQb = feedItemsQb
// and only your own posts/reposts
.where('post.creator', '=', did)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only query change in both PDS and App View

const isActorMedia = isImageEmbed(post.embed)
const isFromActor = post.author.did === carol

return (isRecordWithActorMedia || isActorMedia) && isFromActor
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tightened up these tests to ensure that the author is the actor in question

expect(danFeed.feed.length).toEqual(0)
})

it('filters by posts_no_replies', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And split a test out

Comment on lines 43 to 55
let actorDid = ''
if (actor.startsWith('did:')) {
actorDid = actor
} else {
const actorRes = await ctx.db.db
.selectFrom('did_handle')
.select('did')
.where('did_handle.handle', '=', actor)
.executeTakeFirst()
if (actorRes) {
actorDid = actorRes?.did
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this out of getFeedItemsQb using the same approach as the App View

Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great 👍

think you can use the existing getActorDid method to simplify it a bit (I imagine we're going to start sprinkling that around a bit more)

@estrattonbailey estrattonbailey merged commit d4b7d29 into main Aug 17, 2023
@estrattonbailey estrattonbailey deleted the eric/fix-1167-media-reposts branch August 17, 2023 19:18
@pfrazee
Copy link
Collaborator

pfrazee commented Aug 17, 2023

Sweet!

mloar pushed a commit to mloar/atproto that referenced this pull request Nov 15, 2023
…167-media-reposts

only include media posts by post creator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile media tab should filter out retweets
3 participants