kopia lustrzana https://github.com/nextcloud/social
parse as Note if asked
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/548/head
rodzic
1a04aab7b2
commit
13a03ee457
|
@ -73,6 +73,7 @@ use OCA\Social\Model\ActivityPub\Object\Image;
|
||||||
use OCA\Social\Model\ActivityPub\Object\Note;
|
use OCA\Social\Model\ActivityPub\Object\Note;
|
||||||
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
|
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
|
||||||
use OCA\Social\Model\ActivityPub\Object\Tombstone;
|
use OCA\Social\Model\ActivityPub\Object\Tombstone;
|
||||||
|
use OCA\Social\Model\ActivityPub\Stream;
|
||||||
use OCA\Social\Service\ConfigService;
|
use OCA\Social\Service\ConfigService;
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
|
|
||||||
|
@ -317,6 +318,10 @@ class AP {
|
||||||
$item = new SocialAppNotification();
|
$item = new SocialAppNotification();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Stream::TYPE:
|
||||||
|
$item = new Stream();
|
||||||
|
break;
|
||||||
|
|
||||||
case Person::TYPE:
|
case Person::TYPE:
|
||||||
$item = new Person();
|
$item = new Person();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -473,7 +473,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
$streams = [];
|
$streams = [];
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->execute();
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
$streams[] = $this->parseStreamSelectSql($data);
|
$streams[] = $this->parseStreamSelectSql($data, Note::TYPE);
|
||||||
}
|
}
|
||||||
$cursor->closeCursor();
|
$cursor->closeCursor();
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace OCA\Social\Db;
|
||||||
|
|
||||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||||
use Doctrine\DBAL\Query\QueryBuilder;
|
use Doctrine\DBAL\Query\QueryBuilder;
|
||||||
|
use OCA\Social\AP;
|
||||||
use OCA\Social\Exceptions\InvalidResourceException;
|
use OCA\Social\Exceptions\InvalidResourceException;
|
||||||
use OCA\Social\Model\ActivityPub\ACore;
|
use OCA\Social\Model\ActivityPub\ACore;
|
||||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||||
|
@ -385,11 +386,15 @@ class StreamRequestBuilder extends CoreRequestBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
* @param string $as
|
||||||
*
|
*
|
||||||
* @return Stream
|
* @return Stream
|
||||||
|
* @throws ItemUnknownException
|
||||||
|
* @throws SocialAppConfigException
|
||||||
*/
|
*/
|
||||||
protected function parseStreamSelectSql($data): Stream {
|
protected function parseStreamSelectSql(array $data, string $as = Stream::TYPE): Stream {
|
||||||
$item = new Stream();
|
/** @var Stream $item */
|
||||||
|
$item = AP::$activityPub->getItemFromType($as);
|
||||||
$item->importFromDatabase($data);
|
$item->importFromDatabase($data);
|
||||||
|
|
||||||
$instances = json_decode($this->get('instances', $data, '[]'), true);
|
$instances = json_decode($this->get('instances', $data, '[]'), true);
|
||||||
|
|
|
@ -41,6 +41,9 @@ use OCA\Social\Model\StreamAction;
|
||||||
class Stream extends ACore implements JsonSerializable {
|
class Stream extends ACore implements JsonSerializable {
|
||||||
|
|
||||||
|
|
||||||
|
const TYPE = 'Stream';
|
||||||
|
|
||||||
|
|
||||||
const TYPE_PUBLIC = 'public';
|
const TYPE_PUBLIC = 'public';
|
||||||
const TYPE_UNLISTED = 'unlisted';
|
const TYPE_UNLISTED = 'unlisted';
|
||||||
const TYPE_FOLLOWERS = 'followers';
|
const TYPE_FOLLOWERS = 'followers';
|
||||||
|
|
Ładowanie…
Reference in New Issue