use Friendica\Model\Conversation;
use Friendica\Model\GContact;
use Friendica\Model\Item;
+use Friendica\Model\ItemURI;
+use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
$gcid = GContact::update($contact);
GContact::link($gcid, $contact["uid"], $contact["id"]);
- } elseif ($contact["network"] != Protocol::DFRN) {
+ } elseif (empty($contact["network"]) || ($contact["network"] != Protocol::DFRN)) {
$contact = [];
}
$item = array_merge($header, $author);
$item["uri"] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
+ $item['uri-id'] = ItemURI::insert(['uri' => $item['uri']]);
$item["verb"] = XML::getFirstNodeValue($xpath, 'activity:verb/text()', $entry);
return;
}
- Item::delete($condition);
+ Item::markForDeletion($condition);
Logger::log('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
}
}
$item['tag'] .= '#[url=' . DI::baseUrl() . '/search?tag=' . $term . ']' . $term . '[/url]';
+
+ // Store the hashtag
+ Tag::store($item['uri-id'], Tag::HASHTAG, $term);
}
}
}
$item["body"] = add_page_info_to_body($item["body"]);
}
+ Tag::storeFromBody($item['uri-id'], $item['body']);
+
// Mastodon Content Warning
if (($item["verb"] == Activity::POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
$clear_text = XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry);
$entry = self::entryHeader($doc, $owner, $item, $toplevel);
- $condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
+ $condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => [Item::PUBLIC, Item::UNLISTED],
'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
$repeated_item = Item::selectFirst([], $condition);
if (!DBA::isResult($repeated_item)) {
{
$item["id"] = $item["parent"] = 0;
$item["created"] = $item["edited"] = date("c");
- $item["private"] = true;
+ $item["private"] = Item::PRIVATE;
$contact = Probe::uri($item['follow']);
]);
}
- if (!$item["private"] && !$feed_mode) {
+ if (($item['private'] != Item::PRIVATE) && !$feed_mode) {
XML::addElement($doc, $entry, "link", "", ["rel" => "ostatus:attention",
"href" => "http://activityschema.org/collection/public"]);
XML::addElement($doc, $entry, "link", "", ["rel" => "mentioned",
$authorid = Contact::getIdForURL($owner["url"], 0, true);
$condition = ["`uid` = ? AND `received` > ? AND NOT `deleted`
- AND NOT `private` AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
- $owner["uid"], $check_date, Protocol::OSTATUS, Protocol::DFRN];
+ AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
+ $owner["uid"], $check_date, Item::PRIVATE, Protocol::OSTATUS, Protocol::DFRN];
if ($filter === 'comments') {
$condition[0] .= " AND `object-type` = ? ";