} elseif (($contact["rel"] == Contact::SHARING) || ($contact["rel"] == Contact::FRIEND)) {
// Yes, then it is fine.
return true;
- // Is it a post to a community?
- } elseif (($contact["rel"] == Contact::FOLLOWER) && in_array($importer["page-flags"], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
- // That's good
- return true;
// Is the message a global user or a comment?
} elseif (($importer["uid"] == 0) || $is_comment) {
// Messages for the global users and comments are always accepted
$datarray["object-type"] = Activity\ObjectType::IMAGE;
$datarray["post-type"] = Item::PT_IMAGE;
+ } elseif ($data->poll) {
+ $datarray["object-type"] = Activity\ObjectType::NOTE;
+ $datarray["post-type"] = Item::PT_POLL;
} else {
$datarray["object-type"] = Activity\ObjectType::NOTE;
$datarray["post-type"] = Item::PT_NOTE;
$attachments = Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]);
if (!empty($attachments)) {
- $body .= "\n".DI::l10n()->t("Attachments:")."\n";
+ $body .= "\n[hr]\n";
foreach ($attachments as $attachment) {
$body .= "[" . $attachment['description'] . "](" . $attachment['url'] . ")\n";
}
private static function prependParentAuthorMention($body, $profile_url)
{
- $profile = Contact::getByURL($profile_url, false, ['addr', 'name', 'contact-type']);
+ $profile = Contact::getByURL($profile_url, false, ['addr', 'name']);
if (!empty($profile['addr'])
- && $profile['contact-type'] != Contact::TYPE_COMMUNITY
&& !strstr($body, $profile['addr'])
&& !strstr($body, $profile_url)
) {
$item['private'] = Item::PUBLIC;
}
+ // Don't trigger the addons
+ $item['api_source'] = false;
+
return Item::insert($item, true);
}
}