mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 15:14:27 +02: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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue