$item['post-type'] = Item::PT_NOTE;
}
- $item['isForum'] = false;
+ $item['isGroup'] = false;
if (!empty($activity['thread-completion'])) {
if ($activity['thread-completion'] != $item['owner-id']) {
$item['owner-id'] = $item['author-id'];
} else {
$actor = APContact::getByURL($item['owner-link'], false);
- $item['isForum'] = ($actor['type'] ?? 'Person') == 'Group';
+ $item['isGroup'] = ($actor['type'] ?? 'Person') == 'Group';
}
$item['uri'] = $activity['id'];
case Receiver::TARGET_BCC:
$item['post-reason'] = Item::PR_BCC;
break;
+ case Receiver::TARGET_AUDIENCE:
+ $item['post-reason'] = Item::PR_AUDIENCE;
+ break;
case Receiver::TARGET_FOLLOWER:
$item['post-reason'] = Item::PR_FOLLOWER;
break;
$item['causer-id'] = ($item['gravity'] == Item::GRAVITY_PARENT) ? $item['owner-id'] : $item['author-id'];
}
- if ($item['isForum'] ?? false) {
+ if ($item['isGroup'] ?? false) {
$item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver);
} else {
$item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver);
continue;
}
- if (($receiver != 0) && ($item['gravity'] == Item::GRAVITY_PARENT) && !in_array($item['post-reason'], [Item::PR_FOLLOWER, Item::PR_TAG, item::PR_TO, Item::PR_CC])) {
- if (!($item['isForum'] ?? false)) {
+ if (($receiver != 0) && ($item['gravity'] == Item::GRAVITY_PARENT) && !in_array($item['post-reason'], [Item::PR_FOLLOWER, Item::PR_TAG, item::PR_TO, Item::PR_CC, Item::PR_AUDIENCE])) {
+ if (!($item['isGroup'] ?? false)) {
if ($item['post-reason'] == Item::PR_BCC) {
Logger::info('Top level post via BCC from a non sharer, ignoring', ['uid' => $receiver, 'contact' => $item['contact-id'], 'url' => $item['uri']]);
continue;
}
}
- $is_forum = false;
+ $isGroup = false;
$user = User::getById($receiver, ['account-type']);
if (!empty($user['account-type'])) {
- $is_forum = ($user['account-type'] == User::ACCOUNT_TYPE_COMMUNITY);
+ $isGroup = ($user['account-type'] == User::ACCOUNT_TYPE_COMMUNITY);
}
if ((DI::pConfig()->get($receiver, 'system', 'accept_only_sharer') == Item::COMPLETION_NONE)
- && ((!$is_forum && !($item['isForum'] ?? false) && ($activity['type'] != 'as:Announce'))
+ && ((!$isGroup && !($item['isGroup'] ?? false) && ($activity['type'] != 'as:Announce'))
|| !Contact::isSharingByURL($activity['actor'], $receiver))) {
- Logger::info('Actor is a non sharer, is no forum or it is no announce', ['uid' => $receiver, 'actor' => $activity['actor'], 'url' => $item['uri'], 'type' => $activity['type']]);
+ Logger::info('Actor is a non sharer, is no group or it is no announce', ['uid' => $receiver, 'actor' => $activity['actor'], 'url' => $item['uri'], 'type' => $activity['type']]);
continue;
}
// Store send a follow request for every reshare - but only when the item had been stored
if ($stored && ($item['private'] != Item::PRIVATE) && ($item['gravity'] == Item::GRAVITY_PARENT) && !empty($item['author-link']) && ($item['author-link'] != $item['owner-link'])) {
$author = APContact::getByURL($item['owner-link'], false);
- // We send automatic follow requests for reshared messages. (We don't need though for forum posts)
+ // We send automatic follow requests for reshared messages. (We don't need though for group posts)
if ($author['type'] != 'Group') {
Logger::info('Send follow request', ['uri' => $item['uri'], 'stored' => $stored, 'to' => $item['author-link']]);
ActivityPub\Transmitter::sendFollowObject($item['uri'], $item['author-link']);
public static function storeReceivers(int $uriid, array $receivers)
{
- foreach (['as:to' => Tag::TO, 'as:cc' => Tag::CC, 'as:bto' => Tag::BTO, 'as:bcc' => Tag::BCC] as $element => $type) {
+ foreach (['as:to' => Tag::TO, 'as:cc' => Tag::CC, 'as:bto' => Tag::BTO, 'as:bcc' => Tag::BCC, 'as:audience' => Tag::AUDIENCE, 'as:attributedTo' => Tag::ATTRIBUTED] as $element => $type) {
if (!empty($receivers[$element])) {
foreach ($receivers[$element] as $receiver) {
if ($receiver == ActivityPub::PUBLIC_COLLECTION) {
$activity['id'] = $object['id'];
$activity['to'] = $object['to'] ?? [];
$activity['cc'] = $object['cc'] ?? [];
+ $activity['audience'] = $object['audience'] ?? [];
$activity['actor'] = $actor;
$activity['object'] = $object;
$activity['published'] = $published;