fill status with right export format

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/1775/head
Maxence Lange 2023-06-13 11:44:31 -01:00
rodzic 737ec9549f
commit a9a4629c8b
2 zmienionych plików z 13 dodań i 12 usunięć

Wyświetl plik

@ -144,7 +144,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
public function parseLeftJoinStream(
array $data,
string $prefix = '',
?SocialQueryBuilder $qb = null
int $exportFormat = 0
): Stream {
$new = [];
foreach ($data as $k => $v) {
@ -153,14 +153,15 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
}
}
$stream = new Stream();
$stream->importFromDatabase($new);
$stream->setExportFormat($qb?->getFormat() ?? 0);
if ($stream->getId() === '') {
if (($new['nid'] ?? '') === '') {
throw new InvalidResourceException();
}
$actor = $this->parseLeftJoinCacheActors($data, $prefix . 'cacheactor_', $qb);
$stream = new Stream();
$stream->importFromDatabase($new);
$stream->setExportFormat($exportFormat);
$actor = $this->parseLeftJoinCacheActors($data, $prefix . 'cacheactor_', $exportFormat);
$stream->setActor($actor);
return $stream;
@ -176,7 +177,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
public function parseLeftJoinCacheActors(
array $data,
string $prefix = '',
?SocialQueryBuilder $qb = null
int $exportFormat = 0
): Person {
$new = [];
@ -188,10 +189,10 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
$actor = new Person();
$actor->importFromDatabase($new);
$actor->setExportFormat($qb?->getFormat() ?? 0);
$actor->setExportFormat($exportFormat);
if (!AP::$activityPub->isActor($actor)) {
throw new InvalidResourceException();
throw new InvalidResourceException('actor not actor');
}
try {

Wyświetl plik

@ -36,6 +36,7 @@ use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Object\Announce;
use OCA\Social\Model\ActivityPub\Stream;
use OCA\Social\Model\InstancePath;
@ -217,7 +218,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
}
try {
$actor = $qb->parseLeftJoinCacheActors($data, 'cacheactor_', $qb);
$actor = $qb->parseLeftJoinCacheActors($data, 'cacheactor_', $qb->getFormat());
$actor->setExportFormat($qb->getFormat());
$item->setCompleteDetails(true);
$item->setActor($actor);
@ -225,8 +226,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
}
try {
$object = $qb->parseLeftJoinStream($data, 'objectstream_', $qb);
$object->setExportFormat($qb->getFormat());
$object = $qb->parseLeftJoinStream($data, 'objectstream_', ACore::FORMAT_LOCAL);
$item->setObject($object);
} catch (InvalidResourceException $e) {
}