Announce the object

This commit is contained in:
Will Murphy 2021-11-05 00:06:27 -05:00
parent fdbc15c630
commit 22cc9eb5b2

View file

@ -98,8 +98,9 @@ app.on('apex-inbox', async ({ actor, activity, recipient, object }) => {
switch (activity.type.toLowerCase()) { switch (activity.type.toLowerCase()) {
// automatically reshare incoming posts // automatically reshare incoming posts
case 'create': { case 'create': {
if (!apex.audienceFromActivity(activity).includes(recipient.id)) { // check audience to ignore forwarded messages not adddressed to group
// ignore forwarded messages that aren't directly adddressed to group const audience = apex.audienceFromActivity(activity)
if (!audience.includes(recipient.id) || !activity.object?.length) {
return return
} }
const to = [ const to = [
@ -107,7 +108,7 @@ app.on('apex-inbox', async ({ actor, activity, recipient, object }) => {
apex.consts.publicAddress apex.consts.publicAddress
] ]
const share = await apex.buildActivity('Announce', recipient.id, to, { const share = await apex.buildActivity('Announce', recipient.id, to, {
object: activity.id object: activity.object[0].id
}) })
apex.addToOutbox(recipient, share) apex.addToOutbox(recipient, share)
break break