if ($notify) {
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
// We add the hash of our own host because our host is the original creator of the post.
- $prefix_host = DI::baseUrl()->getHostname();
+ $prefix_host = DI::baseUrl()->getHost();
} else {
$prefix_host = '';
}
}
- if ($notify) {
+ if ($item['origin']) {
if (Photo::setPermissionFromBody($item['body'], $item['uid'], $item['contact-id'], $item['allow_cid'], $item['allow_gid'], $item['deny_cid'], $item['deny_gid'])) {
$item['object-type'] = Activity\ObjectType::IMAGE;
}
Post\Thread::insert($item['uri-id'], $item);
}
- if (!in_array($item['verb'], self::ACTIVITIES)) {
+ // The content of activities normally doesn't matter - except for likes from Misskey
+ if (!in_array($item['verb'], self::ACTIVITIES) || in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE]) && !empty($item['body']) && ($item['body'] != $item['verb'])) {
Post\Content::insert($item['uri-id'], $item);
}
if (!empty($item['event-id'])) {
$event_post = Post::selectFirst(['event-id'], ['uri-id' => $item['uri-id'], 'uid' => $uid]);
if (!empty($event_post['event-id'])) {
- $event = DBA::selectFirst('event', ['edited', 'start', 'finish', 'summary', 'desc', 'location', 'nofinish', 'adjust'], ['id' => $item['event-id']]);
+ $event = DBA::selectFirst('event', ['edited', 'start', 'finish', 'summary', 'desc', 'location', 'nofinish'], ['id' => $item['event-id']]);
if (!empty($event)) {
// We aren't using "Event::store" here, since we don't want to trigger any further action
$ret = DBA::update('event', $event, ['id' => $event_post['event-id']]);
$guid = System::createUUID();
}
- return DI::baseUrl()->get() . '/objects/' . $guid;
+ return DI::baseUrl() . '/objects/' . $guid;
}
/**
}
// Prevent to forward already forwarded posts
- if ($datarray['app'] == DI::baseUrl()->getHostname()) {
+ if ($datarray['app'] == DI::baseUrl()->getHost()) {
Logger::info('Already forwarded (second test)');
return false;
}
return is_numeric($hookData['item_id']) ? $hookData['item_id'] : 0;
}
- $fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri);
+ $fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', ActivityPub\Receiver::COMPLETION_MANUAL, $uid);
if ($fetched_uri) {
$item_id = self::searchByLink($fetched_uri, $uid);