use spread syntax in dedupe recipient Set

This commit is contained in:
Gordon Pedersen 2023-09-21 17:09:05 +10:00
parent 36d8ace51f
commit 71f38cca62
2 changed files with 3 additions and 3 deletions

View file

@ -7,7 +7,7 @@ import { send } from "./request";
export default async function inbox(activity:any) { export default async function inbox(activity:any) {
const date = new Date() const date = new Date()
// get the main recipients ([...new Set()] is to dedupe) // 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 my list of followers in the list of recipients, then forward to them as well
if(recipientList.includes(ACTOR + "/followers")) { if(recipientList.includes(ACTOR + "/followers")) {

View file

@ -35,9 +35,9 @@ export default async function outbox(activity:any):Promise<Response> {
} }
// get the main recipients ([...new Set()] is to dedupe) // 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 // 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 // remove the blind recipients from the activity
delete activity.bto delete activity.bto
delete activity.bcc delete activity.bcc