Switchable contact probing

This commit is contained in:
Michael 2020-04-20 09:47:26 +00:00
parent 21103a5735
commit 27ea747e99
2 changed files with 48 additions and 24 deletions

View file

@ -407,7 +407,7 @@ class Processor
$item['tag'] = self::constructTagString($activity['tags'], $activity['sensitive']);
Tag::storeFromBody($item['uri-id'], $item['body'], '@!');
self::storeFromBody($item);
self::storeTags($item['uri-id'], $activity['tags']);
$item['location'] = $activity['location'];
@ -421,6 +421,14 @@ class Processor
return $item;
}
private static function storeFromBody($item)
{
// Make sure to delete all existing tags (can happen when called via the update functionality)
DBA::delete('post-tag', ['uri-id' => $uriid]);
Tag::storeFromBody($item['uri-id'], $item['body'], '@!');
}
/**
* Generate a GUID out of an URL
*
@ -588,9 +596,6 @@ class Processor
*/
private static function storeTags(int $uriid, array $tags = null)
{
// Make sure to delete all existing tags (can happen when called via the update functionality)
DBA::delete('post-tag', ['uri-id' => $uriid]);
foreach ($tags as $tag) {
if (empty($tag['name']) || empty($tag['type']) || !in_array($tag['type'], ['Mention', 'Hashtag'])) {
continue;
@ -622,7 +627,7 @@ class Processor
if (empty($tag['name'])) {
continue;
}
Tag::store($uriid, $type, $tag['name'], $tag['href']);
}
}