Merge pull request #548 from nextcloud/bugfix/noid/stream-as-note

fix issue with getHashtags on Stream
pull/549/head
Maxence Lange 2019-05-29 22:01:41 -01:00 zatwierdzone przez GitHub
commit 202402092f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 19 dodań i 4 usunięć

Wyświetl plik

@ -73,6 +73,7 @@ use OCA\Social\Model\ActivityPub\Object\Image;
use OCA\Social\Model\ActivityPub\Object\Note;
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
use OCA\Social\Model\ActivityPub\Object\Tombstone;
use OCA\Social\Model\ActivityPub\Stream;
use OCA\Social\Service\ConfigService;
use OCP\AppFramework\QueryException;
@ -317,6 +318,10 @@ class AP {
$item = new SocialAppNotification();
break;
case Stream::TYPE:
$item = new Stream();
break;
case Person::TYPE:
$item = new Person();
break;

Wyświetl plik

@ -473,7 +473,7 @@ class StreamRequest extends StreamRequestBuilder {
$streams = [];
$cursor = $qb->execute();
while ($data = $cursor->fetch()) {
$streams[] = $this->parseStreamSelectSql($data);
$streams[] = $this->parseStreamSelectSql($data, Note::TYPE);
}
$cursor->closeCursor();

Wyświetl plik

@ -32,7 +32,10 @@ namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools;
use Doctrine\DBAL\Query\QueryBuilder;
use OCA\Social\AP;
use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Stream;
@ -385,11 +388,15 @@ class StreamRequestBuilder extends CoreRequestBuilder {
/**
* @param array $data
* @param string $as
*
* @return Stream
* @throws ItemUnknownException
* @throws SocialAppConfigException
*/
protected function parseStreamSelectSql($data): Stream {
$item = new Stream();
protected function parseStreamSelectSql(array $data, string $as = Stream::TYPE): Stream {
/** @var Stream $item */
$item = AP::$activityPub->getItemFromType($as);
$item->importFromDatabase($data);
$instances = json_decode($this->get('instances', $data, '[]'), true);

Wyświetl plik

@ -59,7 +59,7 @@ class SocialAppNotification extends Stream implements JsonSerializable {
* @throws Exception
*/
public function import(array $data) {
parent::import($data);
//parent::import($data);
}

Wyświetl plik

@ -41,6 +41,9 @@ use OCA\Social\Model\StreamAction;
class Stream extends ACore implements JsonSerializable {
const TYPE = 'Stream';
const TYPE_PUBLIC = 'public';
const TYPE_UNLISTED = 'unlisted';
const TYPE_FOLLOWERS = 'followers';