mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-12-22 23:50:20 +00:00
Merge pull request 'Tumblr: Handle quote shares' (#1480) from heluecht/friendica-addons:issue-13972 into 2024.03-rc
Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1480
This commit is contained in:
commit
3da448b01f
1 changed files with 10 additions and 1 deletions
|
@ -677,11 +677,20 @@ function tumblr_send_npf(array $post): bool
|
|||
return true;
|
||||
}
|
||||
|
||||
$post['body'] = Post\Media::addAttachmentsToBody($post['uri-id'], $post['body']);
|
||||
$post['body'] = Post\Media::addAttachmentsToBody($post['uri-id'], $post['body'], [Post\Media::IMAGE, Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::ACTIVITY]);
|
||||
if (!empty($post['title'])) {
|
||||
$post['body'] = '[h1]' . $post['title'] . "[/h1]\n" . $post['body'];
|
||||
}
|
||||
|
||||
if (!empty($post['quote-uri-id'])) {
|
||||
$quote = Post::selectFirstPost(['uri', 'plink'], ['uri-id' => $post['quote-uri-id']]);
|
||||
if (!empty($quote)) {
|
||||
if ((strpos($post['body'], $quote['plink'] ?: $quote['uri']) === false) && (strpos($post['body'], $quote['uri']) === false)) {
|
||||
$post['body'] .= "\n[url]" . ($quote['plink'] ?: $quote['uri']) . "[/url]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$params = [
|
||||
'content' => NPF::fromBBCode($post['body'], $post['uri-id']),
|
||||
'state' => 'published',
|
||||
|
|
Loading…
Reference in a new issue