Don't transmit the shared attachments
This commit is contained in:
parent
59004711ec
commit
d43b85e94b
|
@ -1407,27 +1407,16 @@ class Transmitter
|
||||||
* Adds attachment data to the JSON document
|
* Adds attachment data to the JSON document
|
||||||
*
|
*
|
||||||
* @param array $item Data of the item that is to be posted
|
* @param array $item Data of the item that is to be posted
|
||||||
* @param string $type Object type
|
|
||||||
*
|
*
|
||||||
* @return array with attachment data
|
* @return array with attachment data
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
private static function createAttachmentList(array $item, string $type): array
|
private static function createAttachmentList(array $item): array
|
||||||
{
|
{
|
||||||
$attachments = [];
|
$attachments = [];
|
||||||
|
|
||||||
$uriids = [$item['uri-id']];
|
|
||||||
$shared = BBCode::fetchShareAttributes($item['body']);
|
|
||||||
if (!empty($shared['guid'])) {
|
|
||||||
$shared_item = Post::selectFirst(['uri-id'], ['guid' => $shared['guid']]);
|
|
||||||
if (!empty($shared_item['uri-id'])) {
|
|
||||||
$uriids[] = $shared_item['uri-id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$urls = [];
|
$urls = [];
|
||||||
foreach ($uriids as $uriid) {
|
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
|
||||||
foreach (Post\Media::getByURIId($uriid, [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
|
|
||||||
if (in_array($attachment['url'], $urls)) {
|
if (in_array($attachment['url'], $urls)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1452,7 +1441,6 @@ class Transmitter
|
||||||
|
|
||||||
$attachments[] = $attach;
|
$attachments[] = $attach;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $attachments;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
@ -1688,6 +1676,12 @@ class Transmitter
|
||||||
$language = self::getLanguage($item);
|
$language = self::getLanguage($item);
|
||||||
if (!empty($language)) {
|
if (!empty($language)) {
|
||||||
$richbody = BBCode::setMentionsToNicknames($item['body'] ?? '');
|
$richbody = BBCode::setMentionsToNicknames($item['body'] ?? '');
|
||||||
|
|
||||||
|
$shared = BBCode::fetchShareAttributes($richbody);
|
||||||
|
if (!empty($shared['link']) && !empty($shared['guid']) && !empty($shared['comment'])) {
|
||||||
|
$richbody = self::ReplaceSharedData($richbody);
|
||||||
|
}
|
||||||
|
|
||||||
$richbody = BBCode::removeAttachment($richbody);
|
$richbody = BBCode::removeAttachment($richbody);
|
||||||
|
|
||||||
$data['contentMap'][$language] = BBCode::convertForUriId($item['uri-id'], $richbody, BBCode::EXTERNAL);
|
$data['contentMap'][$language] = BBCode::convertForUriId($item['uri-id'], $richbody, BBCode::EXTERNAL);
|
||||||
|
@ -1699,8 +1693,8 @@ class Transmitter
|
||||||
$data['diaspora:comment'] = $item['signed_text'];
|
$data['diaspora:comment'] = $item['signed_text'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['attachment'] = self::createAttachmentList($item, $type);
|
$data['attachment'] = self::createAttachmentList($item);
|
||||||
$data['tag'] = self::createTagList($item, $data['quoteUrl'] ?? '');
|
$data['tag'] = self::createTagList($item, ''); // $data['quoteUrl'] ??
|
||||||
|
|
||||||
if (empty($data['location']) && (!empty($item['coord']) || !empty($item['location']))) {
|
if (empty($data['location']) && (!empty($item['coord']) || !empty($item['location']))) {
|
||||||
$data['location'] = self::createLocation($item);
|
$data['location'] = self::createLocation($item);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user