API: photos are now directly stored as attached data and not in the body anymore

This commit is contained in:
Michael 2021-05-01 15:48:19 +00:00
parent 60f0af3daa
commit 4b12c54345
6 changed files with 89 additions and 54 deletions

View file

@ -21,7 +21,6 @@
namespace Friendica\Model;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Hook;
@ -960,7 +959,13 @@ class Item
self::setOwnerforResharedItem($item);
}
Post\Media::insertFromAttachmentData($item['uri-id'], $item['body']);
if (isset($item['attachments'])) {
foreach ($item['attachments'] as $attachment) {
$attachment['uri-id'] = $item['uri-id'];
Post\Media::insert($attachment);
}
unset($item['attachments']);
}
// 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']);