Add relevant link after media links had been removed
This commit is contained in:
parent
2258544237
commit
6f730bd671
1 changed files with 10 additions and 8 deletions
|
@ -180,16 +180,18 @@ class Item
|
||||||
if (!empty($fields['body'])) {
|
if (!empty($fields['body'])) {
|
||||||
Post\Media::insertFromAttachmentData($item['uri-id'], $fields['body']);
|
Post\Media::insertFromAttachmentData($item['uri-id'], $fields['body']);
|
||||||
|
|
||||||
if ($item['author-network'] != Protocol::DFRN) {
|
|
||||||
Post\Media::insertFromRelevantUrl($item['uri-id'], $fields['body']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$content_fields = ['raw-body' => trim($fields['raw-body'] ?? $fields['body'])];
|
$content_fields = ['raw-body' => trim($fields['raw-body'] ?? $fields['body'])];
|
||||||
|
|
||||||
// Remove all media attachments from the body and store them in the post-media table
|
// Remove all media attachments from the body and store them in the post-media table
|
||||||
// @todo On shared postings (Diaspora style and commented reshare) don't fetch content from the shared part
|
// @todo On shared postings (Diaspora style and commented reshare) don't fetch content from the shared part
|
||||||
$content_fields['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $content_fields['raw-body']);
|
$content_fields['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $content_fields['raw-body']);
|
||||||
$content_fields['raw-body'] = self::setHashtags($content_fields['raw-body']);
|
$content_fields['raw-body'] = self::setHashtags($content_fields['raw-body']);
|
||||||
|
|
||||||
|
if ($item['author-network'] != Protocol::DFRN) {
|
||||||
|
Post\Media::insertFromRelevantUrl($item['uri-id'], $content_fields['raw-body']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Post\Content::update($item['uri-id'], $content_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fields['file'])) {
|
if (!empty($fields['file'])) {
|
||||||
|
@ -991,14 +993,14 @@ class Item
|
||||||
|
|
||||||
Post\Media::insertFromAttachmentData($item['uri-id'], $item['body']);
|
Post\Media::insertFromAttachmentData($item['uri-id'], $item['body']);
|
||||||
|
|
||||||
if (!DBA::exists('contact', ['id' => $item['author-id'], 'network' => Protocol::DFRN])) {
|
|
||||||
Post\Media::insertFromRelevantUrl($item['uri-id'], $item['body']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove all media attachments from the body and store them in the post-media table
|
// Remove all media attachments from the body and store them in the post-media table
|
||||||
$item['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $item['raw-body']);
|
$item['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $item['raw-body']);
|
||||||
$item['raw-body'] = self::setHashtags($item['raw-body']);
|
$item['raw-body'] = self::setHashtags($item['raw-body']);
|
||||||
|
|
||||||
|
if (!DBA::exists('contact', ['id' => $item['author-id'], 'network' => Protocol::DFRN])) {
|
||||||
|
Post\Media::insertFromRelevantUrl($item['uri-id'], $item['raw-body']);
|
||||||
|
}
|
||||||
|
|
||||||
// Check for hashtags in the body and repair or add hashtag links
|
// Check for hashtags in the body and repair or add hashtag links
|
||||||
$item['body'] = self::setHashtags($item['body']);
|
$item['body'] = self::setHashtags($item['body']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue