mirror of
https://github.com/friendica/friendica
synced 2025-04-24 14:30:11 +00:00
The quote functionality is simplified
This commit is contained in:
parent
b5ad8c3e15
commit
0d3aa681b4
10 changed files with 170 additions and 257 deletions
|
@ -850,7 +850,7 @@ class Processor
|
|||
$item['raw-body'] = $item['body'] = $content;
|
||||
|
||||
if (!empty($activity['quote-url'])) {
|
||||
$item['body'] .= self::addSharedData($activity['quote-url']);
|
||||
$item['body'] .= DI::contentItem()->createSharedPostByUrl($activity['quote-url']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -870,41 +870,6 @@ class Processor
|
|||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a share block for the given quote link
|
||||
*
|
||||
* @param string $url
|
||||
* @return string
|
||||
*/
|
||||
private static function addSharedData(string $url): string
|
||||
{
|
||||
$id = Item::fetchByLink($url);
|
||||
if (empty($id)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$shared_item = Post::selectFirst(['author-name', 'author-link', 'author-avatar', 'plink', 'created', 'guid', 'uri', 'title', 'body'], ['id' => $id]);
|
||||
if (!DBA::isResult($shared_item)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$prefix = BBCode::getShareOpeningTag(
|
||||
$shared_item['author-name'],
|
||||
$shared_item['author-link'],
|
||||
$shared_item['author-avatar'],
|
||||
$shared_item['plink'],
|
||||
$shared_item['created'],
|
||||
$shared_item['guid'],
|
||||
$shared_item['uri'],
|
||||
);
|
||||
|
||||
if (!empty($shared_item['title'])) {
|
||||
$prefix .= '[h3]' . $shared_item['title'] . "[/h3]\n";
|
||||
}
|
||||
|
||||
return $prefix . $shared_item['body'] . '[/share]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Store hashtags and mentions
|
||||
*
|
||||
|
|
|
@ -512,7 +512,10 @@ class Receiver
|
|||
// }
|
||||
// }
|
||||
|
||||
Logger::info('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id']);
|
||||
$account = Contact::selectFirstAccount(['platform'], ['nurl' => Strings::normaliseLink($actor)]);
|
||||
$platform = $account['platform'] ?? '';
|
||||
|
||||
Logger::info('Processing', ['type' => $object_data['type'], 'object_type' => $object_data['object_type'], 'id' => $object_data['id'], 'actor' => $actor, 'platform' => $platform]);
|
||||
|
||||
return $object_data;
|
||||
}
|
||||
|
@ -1148,6 +1151,17 @@ class Receiver
|
|||
|
||||
self::switchContacts($receivers, $actor);
|
||||
|
||||
// "birdsitelive" is a service that mirrors tweets into the fediverse
|
||||
// These posts can be fetched without authentification, but are not marked as public
|
||||
// We treat them as unlisted posts to be able to handle them.
|
||||
if (empty($receivers) && $fetch_unlisted && Contact::isPlatform($actor, 'birdsitelive')) {
|
||||
$receivers[0] = ['uid' => 0, 'type' => self::TARGET_GLOBAL];
|
||||
$receivers[-1] = ['uid' => -1, 'type' => self::TARGET_GLOBAL];
|
||||
Logger::notice('Post from "birdsitelive" is set to "unlisted"', ['id' => JsonLD::fetchElement($activity, '@id')]);
|
||||
} elseif (empty($receivers)) {
|
||||
Logger::notice('Post has got no receivers', ['fetch_unlisted' => $fetch_unlisted, 'actor' => $actor, 'id' => JsonLD::fetchElement($activity, '@id'), 'type' => JsonLD::fetchElement($activity, '@type')]);
|
||||
}
|
||||
|
||||
return $receivers;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue