From 71f38cca62ad44a2d7018b19bf1536135a0f1af6 Mon Sep 17 00:00:00 2001 From: Gordon Pedersen Date: Thu, 21 Sep 2023 17:09:05 +1000 Subject: [PATCH] use spread syntax in dedupe recipient Set --- src/inbox.ts | 2 +- src/outbox.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/inbox.ts b/src/inbox.ts index 50646be..dad33f7 100644 --- a/src/inbox.ts +++ b/src/inbox.ts @@ -7,7 +7,7 @@ import { send } from "./request"; export default async function inbox(activity:any) { const date = new Date() // get the main recipients ([...new Set()] is to dedupe) - const recipientList = [...new Set(idsFromValue(activity.to).concat(idsFromValue(activity.cc)).concat(idsFromValue(activity.audience)))] + const recipientList = [...new Set([...idsFromValue(activity.to), ...idsFromValue(activity.cc), ...idsFromValue(activity.audience)])] // if my list of followers in the list of recipients, then forward to them as well if(recipientList.includes(ACTOR + "/followers")) { diff --git a/src/outbox.ts b/src/outbox.ts index acd25b7..cdeccb8 100644 --- a/src/outbox.ts +++ b/src/outbox.ts @@ -35,9 +35,9 @@ export default async function outbox(activity:any):Promise { } // get the main recipients ([...new Set()] is to dedupe) - const recipientList = [...new Set(idsFromValue(activity.to).concat(idsFromValue(activity.cc)).concat(idsFromValue(activity.audience)))] + const recipientList = [...new Set([...idsFromValue(activity.to), ...idsFromValue(activity.cc), ...idsFromValue(activity.audience)])] // add in the blind recipients - const finalRecipientList = [...new Set(recipientList.concat(idsFromValue(activity.bto)).concat(idsFromValue(activity.bcc)))] + const finalRecipientList = [...new Set([...recipientList, ...idsFromValue(activity.bto), ...idsFromValue(activity.bcc)])] // remove the blind recipients from the activity delete activity.bto delete activity.bcc