Announce the object
This commit is contained in:
parent
fdbc15c630
commit
22cc9eb5b2
1 changed files with 4 additions and 3 deletions
7
index.js
7
index.js
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue