-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove author blocks from getLikes (#3012)
* Capture the issue in a test case * Remove 3p blocks in getLikes * fix test that captures the bug * remove unnecessary hydration * Remove `!viewer` check
- Loading branch information
1 parent
4bf368f
commit 3303ff1
Showing
3 changed files
with
128 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ describe('pds like views', () => { | |
// account dids, for convenience | ||
let alice: string | ||
let bob: string | ||
let carol: string | ||
let frankie: string | ||
|
||
beforeAll(async () => { | ||
network = await TestNetwork.create({ | ||
|
@@ -19,9 +21,17 @@ describe('pds like views', () => { | |
agent = network.bsky.getClient() | ||
sc = network.getSeedClient() | ||
await likesSeed(sc) | ||
await sc.createAccount('frankie', { | ||
handle: 'frankie.test', | ||
email: '[email protected]', | ||
password: 'password', | ||
}) | ||
await network.processAll() | ||
|
||
alice = sc.dids.alice | ||
bob = sc.dids.bob | ||
carol = sc.dids.carol | ||
frankie = sc.dids.frankie | ||
}) | ||
|
||
afterAll(async () => { | ||
|
@@ -108,4 +118,70 @@ describe('pds like views', () => { | |
}), | ||
) | ||
}) | ||
|
||
it(`author viewer doesn't see likes by user the author blocked`, async () => { | ||
await sc.like(frankie, sc.posts[alice][1].ref) | ||
await network.processAll() | ||
|
||
const beforeBlock = await agent.app.bsky.feed.getLikes( | ||
{ uri: sc.posts[alice][1].ref.uriStr }, | ||
{ headers: await network.serviceHeaders(alice, ids.AppBskyFeedGetLikes) }, | ||
) | ||
|
||
expect(beforeBlock.data.likes.map((like) => like.actor.did)).toStrictEqual([ | ||
sc.dids.frankie, | ||
sc.dids.eve, | ||
sc.dids.dan, | ||
sc.dids.carol, | ||
sc.dids.bob, | ||
]) | ||
|
||
await sc.block(alice, frankie) | ||
await network.processAll() | ||
|
||
const afterBlock = await agent.app.bsky.feed.getLikes( | ||
{ uri: sc.posts[alice][1].ref.uriStr }, | ||
{ headers: await network.serviceHeaders(alice, ids.AppBskyFeedGetLikes) }, | ||
) | ||
|
||
expect(afterBlock.data.likes.map((like) => like.actor.did)).toStrictEqual([ | ||
sc.dids.eve, | ||
sc.dids.dan, | ||
sc.dids.carol, | ||
sc.dids.bob, | ||
]) | ||
}) | ||
|
||
it(`non-author viewer doesn't see likes by user the author blocked and by user the viewer blocked `, async () => { | ||
await sc.unblock(alice, frankie) | ||
await network.processAll() | ||
|
||
const beforeBlock = await agent.app.bsky.feed.getLikes( | ||
{ uri: sc.posts[alice][1].ref.uriStr }, | ||
{ headers: await network.serviceHeaders(bob, ids.AppBskyFeedGetLikes) }, | ||
) | ||
|
||
expect(beforeBlock.data.likes.map((like) => like.actor.did)).toStrictEqual([ | ||
sc.dids.frankie, | ||
sc.dids.eve, | ||
sc.dids.dan, | ||
sc.dids.carol, | ||
sc.dids.bob, | ||
]) | ||
|
||
await sc.block(alice, frankie) | ||
await sc.block(bob, carol) | ||
await network.processAll() | ||
|
||
const afterBlock = await agent.app.bsky.feed.getLikes( | ||
{ uri: sc.posts[alice][1].ref.uriStr }, | ||
{ headers: await network.serviceHeaders(bob, ids.AppBskyFeedGetLikes) }, | ||
) | ||
|
||
expect(afterBlock.data.likes.map((like) => like.actor.did)).toStrictEqual([ | ||
sc.dids.eve, | ||
sc.dids.dan, | ||
sc.dids.bob, | ||
]) | ||
}) | ||
}) |