Improved fetching of attached activities
This commit is contained in:
parent
d425f2eaac
commit
8ab7e6552b
|
@ -323,8 +323,13 @@ class Status extends BaseFactory
|
|||
{
|
||||
if (empty($item['quote-uri-id'])) {
|
||||
$media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]);
|
||||
if (!empty($media) && $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]])) {
|
||||
$quote_id = $shared_item['uri-id'];
|
||||
if (!empty($media)) {
|
||||
if (!empty($media['media-uri-id'])) {
|
||||
$quote_id = $media['media-uri-id'];
|
||||
} else {
|
||||
$shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]]);
|
||||
$quote_id = $shared_item['uri-id'] ?? 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$quote_id = $item['quote-uri-id'];
|
||||
|
|
|
@ -3044,7 +3044,12 @@ class Item
|
|||
} elseif (empty($shared_item['uri-id']) && empty($item['quote-uri-id']) && ($item['network'] != Protocol::DIASPORA)) {
|
||||
$media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]);
|
||||
if (!empty($media)) {
|
||||
$shared_item = Post::selectFirst($fields, ['uri-id' => $media[0]['media-uri-id'], 'uid' => [$item['uid'], 0]]);
|
||||
if (empty($shared_item['uri-id'])) {
|
||||
$shared_item = Post::selectFirst($fields, ['plink' => $media[0]['url'], 'uid' => [$item['uid'], 0]]);
|
||||
} elseif (strtolower($shared['post']['uri']) != strtolower($media[0]['url'])) {
|
||||
$shared_links[] = strtolower($media[0]['url']);
|
||||
}
|
||||
|
||||
if (empty($shared_item['uri-id'])) {
|
||||
$shared_item = Post::selectFirst($fields, ['uri' => $media[0]['url'], 'uid' => [$item['uid'], 0]]);
|
||||
|
|
|
@ -222,7 +222,7 @@ class Upload extends \Friendica\BaseModule
|
|||
}
|
||||
|
||||
$this->logger->info('upload done');
|
||||
$this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $owner['nickname'] . '/image/' . $resource_id . '][img]' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "[/img][/url]\n\n");
|
||||
$this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $owner['nickname'] . '/image/' . $resource_id . '][img=' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "][/img][/url]\n\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue