Commit 141bae6a authored by Mark Harding's avatar Mark Harding Committed by Mark Harding

(fix): if faux activities then cast as such

parent 2b7a7452
No related merge requests found
Pipeline #70505659 running with stages
......@@ -157,6 +157,7 @@ class feeds implements Interfaces\Api
'sync' => $sync,
'query' => $query ?? null,
'single_owner_threshold' => 36,
'as_activities' => $asActivities,
];
$nsfw = $_GET['nsfw'] ?? '';
......
......@@ -22,6 +22,9 @@ class Manager
/** @var EntitiesBuilder */
protected $entitiesBuilder;
/** @var Entities */
protected $entities;
private $from;
private $to;
......@@ -33,11 +36,13 @@ class Manager
public function __construct(
$repository = null,
$entitiesBuilder = null,
$entities = null,
$search = null
)
{
$this->repository = $repository ?: new Repository;
$this->entitiesBuilder = $entitiesBuilder ?: new EntitiesBuilder;
$this->entities = $entities ?: new Entities;
$this->search = $search ?: Di::_()->get('Search\Search');
$this->from = strtotime('-7 days') * 1000;
......@@ -90,6 +95,7 @@ class Manager
'single_owner_threshold' => 36,
'filter_hashtags' => false,
'pinned_guids' => null,
'as_activities' => false,
], $opts);
if (isset($opts['query']) && $opts['query']) {
......@@ -130,7 +136,11 @@ class Manager
if (strpos($entityType, 'object:', 0) === 0) {
$entityType = str_replace('object:', '', $entityType);
}
if ($opts['as_activities'] && !in_array($opts['type'], [ 'user', 'group' ])) {
$entityType = 'activity';
}
$urn = implode(':', [
'urn',
$entityType,
......@@ -164,6 +174,9 @@ class Manager
if ($opts['pinned_guids'] && in_array($entity->getGuid(), $opts['pinned_guids'])) {
$entity->pinned = true;
}
if ($opts['as_activities']) {
$entity = $this->entities->cast($entity);
}
$entities[] = (new FeedSyncEntity)
->setGuid($entity->getGuid())
->setOwnerGuid($entity->getOwnerGuid())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment