Skip to content

Commit

Permalink
Announce the object
Browse files Browse the repository at this point in the history
  • Loading branch information
wmurphyrd committed Nov 5, 2021
1 parent fdbc15c commit 22cc9eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,17 @@ app.on('apex-inbox', async ({ actor, activity, recipient, object }) => {
switch (activity.type.toLowerCase()) {
// automatically reshare incoming posts
case 'create': {
if (!apex.audienceFromActivity(activity).includes(recipient.id)) {
// ignore forwarded messages that aren't directly adddressed to group
// check audience to ignore forwarded messages not adddressed to group
const audience = apex.audienceFromActivity(activity)
if (!audience.includes(recipient.id) || !activity.object?.length) {
return
}
const to = [
recipient.followers[0],
apex.consts.publicAddress
]
const share = await apex.buildActivity('Announce', recipient.id, to, {
object: activity.id
object: activity.object[0].id
})
apex.addToOutbox(recipient, share)
break
Expand Down

0 comments on commit 22cc9eb

Please sign in to comment.