Merge branch 'relationships-mute' into 'main'

Relationships: fix blocks and mutes being switched

See merge request soapbox-pub/ditto!232
This commit is contained in:
Alex Gleason 2024-05-08 16:13:34 +00:00
commit b6dd49e2ef
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: [targetPubkey], 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 target3 = events.find((event) => event.kind === 3 && event.pubkey === targetPubkey);
const event10000 = events.find((event) => event.kind === 10000 && event.pubkey === sourcePubkey);
const target10000 = events.find((event) => event.kind === 10000 && event.pubkey === targetPubkey);
return {
id: targetPubkey,
@ -20,9 +18,9 @@ async function renderRelationship(sourcePubkey: string, targetPubkey: string) {
showing_reblogs: true,
notifying: false,
followed_by: target3 ? hasTag(target3?.tags, ['p', sourcePubkey]) : false,
blocking: event10000 ? hasTag(event10000.tags, ['p', targetPubkey]) : false,
blocked_by: target10000 ? hasTag(target10000.tags, ['p', sourcePubkey]) : false,
muting: false,
blocking: false,
blocked_by: false,
muting: event10000 ? hasTag(event10000.tags, ['p', targetPubkey]) : false,
muting_notifications: false,
requested: false,
domain_blocking: false,