Relationships: fix blocks and mutes being switched

This commit is contained in:
Alex Gleason 2024-05-08 10:41:05 -05:00
parent 66bae5eea7
commit 7ad0e4d9e9
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 3 additions and 5 deletions

View File

@ -6,13 +6,11 @@ async function renderRelationship(sourcePubkey: string, targetPubkey: string) {
{ kinds: [3], authors: [sourcePubkey], limit: 1 }, { kinds: [3], authors: [sourcePubkey], limit: 1 },
{ kinds: [3], authors: [targetPubkey], limit: 1 }, { kinds: [3], authors: [targetPubkey], limit: 1 },
{ kinds: [10000], authors: [sourcePubkey], limit: 1 }, { kinds: [10000], authors: [sourcePubkey], limit: 1 },
{ kinds: [10000], authors: [targetPubkey], limit: 1 },
]); ]);
const event3 = events.find((event) => event.kind === 3 && event.pubkey === sourcePubkey); const event3 = events.find((event) => event.kind === 3 && event.pubkey === sourcePubkey);
const target3 = events.find((event) => event.kind === 3 && event.pubkey === targetPubkey); const target3 = events.find((event) => event.kind === 3 && event.pubkey === targetPubkey);
const event10000 = events.find((event) => event.kind === 10000 && event.pubkey === sourcePubkey); const event10000 = events.find((event) => event.kind === 10000 && event.pubkey === sourcePubkey);
const target10000 = events.find((event) => event.kind === 10000 && event.pubkey === targetPubkey);
return { return {
id: targetPubkey, id: targetPubkey,
@ -20,9 +18,9 @@ async function renderRelationship(sourcePubkey: string, targetPubkey: string) {
showing_reblogs: true, showing_reblogs: true,
notifying: false, notifying: false,
followed_by: target3 ? hasTag(target3?.tags, ['p', sourcePubkey]) : false, followed_by: target3 ? hasTag(target3?.tags, ['p', sourcePubkey]) : false,
blocking: event10000 ? hasTag(event10000.tags, ['p', targetPubkey]) : false, blocking: false,
blocked_by: target10000 ? hasTag(target10000.tags, ['p', sourcePubkey]) : false, blocked_by: false,
muting: false, muting: event10000 ? hasTag(event10000.tags, ['p', targetPubkey]) : false,
muting_notifications: false, muting_notifications: false,
requested: false, requested: false,
domain_blocking: false, domain_blocking: false,