From 464faba25b8455c3071557a000a39e750b3edd3c Mon Sep 17 00:00:00 2001 From: devin ivy Date: Tue, 30 Jan 2024 20:24:19 -0500 Subject: [PATCH] Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks --- packages/bsky/src/hydration/graph.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/bsky/src/hydration/graph.ts b/packages/bsky/src/hydration/graph.ts index b14d24334c0..efcd2fb9948 100644 --- a/packages/bsky/src/hydration/graph.ts +++ b/packages/bsky/src/hydration/graph.ts @@ -29,12 +29,13 @@ export type RelationshipPair = [didA: string, didB: string] const dedupePairs = (pairs: RelationshipPair[]): RelationshipPair[] => { const mapped = pairs.reduce((acc, cur) => { - const sorted = cur.sort() + const sorted = ([...cur] as RelationshipPair).sort() acc[sorted.join('-')] = sorted return acc }, {} as Record) return Object.values(mapped) } + export class Blocks { _blocks: Map = new Map() constructor() {} @@ -55,6 +56,7 @@ export class Blocks { } isBlocked(didA: string, didB: string): boolean { + if (didA === didB) return false // ignore self-blocks const key = Blocks.key(didA, didB) return this._blocks.get(key) ?? false }