*/
const MIRROR_DEACTIVATED = 0;
- const MIRROR_FORWARDED = 1;
+ const MIRROR_FORWARDED = 1; // Deprecated, now does the same like MIRROR_OWN_POST
const MIRROR_OWN_POST = 2;
const MIRROR_NATIVE_RESHARE = 3;
$item['protocol'] = Conversation::PARCEL_DIRECT;
$item['direction'] = Conversation::PUSH;
- if (!empty($item['author-link']) && !empty($item['author-id'])) {
- $owner = User::getOwnerDataById($item['uid']);
+ $owner = User::getOwnerDataById($item['uid']);
+
+ if (empty($item['contact-id'])) {
+ $item['contact-id'] = $owner['id'];
+ }
+
+ if (empty($item['author-link']) && empty($item['author-id'])) {
$item['author-link'] = $owner['url'];
$item['author-name'] = $owner['name'];
$item['author-avatar'] = $owner['thumb'];
}
- if (!empty($item['owner-link']) && !empty($item['owner-id'])) {
+ if (empty($item['owner-link']) && empty($item['owner-id'])) {
$item['owner-link'] = $item['author-link'];
$item['owner-name'] = $item['author-name'];
$item['owner-avatar'] = $item['author-avatar'];
}
+ // Setting the object type if not defined before
+ if (empty($item['object-type'])) {
+ $item['object-type'] = Activity\ObjectType::NOTE; // Default value
+ $objectdata = BBCode::getAttachedData($item['body']);
+
+ if ($objectdata['type'] == 'link') {
+ $item['object-type'] = Activity\ObjectType::BOOKMARK;
+ } elseif ($objectdata['type'] == 'video') {
+ $item['object-type'] = Activity\ObjectType::VIDEO;
+ } elseif ($objectdata['type'] == 'photo') {
+ $item['object-type'] = Activity\ObjectType::IMAGE;
+ }
+ }
+
return $item;
}
if ($contact['network'] == Protocol::FEED) {
$remote_self_options = [
Contact::MIRROR_DEACTIVATED => $this->t('No mirroring'),
- Contact::MIRROR_FORWARDED => $this->t('Mirror as forwarded posting'),
Contact::MIRROR_OWN_POST => $this->t('Mirror as my own posting')
];
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) {