Commit a4b616ff authored by Mark Harding's avatar Mark Harding

(feat): use hydrated entity and export

1 merge request!100Epic/reporting and moderation
Pipeline #61726798 passed with stages
in 4 minutes and 23 seconds
......@@ -15,7 +15,7 @@ use Minds\Core\Reports\Summons\Summon as SummonEntity;
use Minds\Core\Session;
use Minds\Interfaces;
class summon implements Interfaces\Api
class summons implements Interfaces\Api
{
/**
* Equivalent to HTTP GET method
......@@ -43,8 +43,8 @@ class summon implements Interfaces\Api
/** @var Manager $summonsManager */
$summonsManager = Di::_()->get('Moderation\Summons\Manager');
/** @var ReportsRepository $reportsRepository */
$reportsRepository = Di::_()->get('Reports\Repository');
/** @var ReportsManager $reportsManager */
$reportsManager = Di::_()->get('Moderation\Manager');
$summon = new SummonEntity();
try {
......@@ -75,7 +75,9 @@ class summon implements Interfaces\Api
];
if ($summon->isAccepted()) {
$response['report'] = $reportsRepository->get($summon->getReportUrn());
$response['report'] = $reportsManager
->getReport($summon->getReportUrn())
->export();
}
return Factory::response($response);
......
......@@ -63,9 +63,19 @@ class Manager
return $response;
}
/**
* Return a single report
* @param string $urn
* @return Report
*/
public function getReport($urn)
{
return $this->repository->get($urn);
$report = $this->repository->get($urn);
$entity = $this->entitiesResolver->single(
(new Urn())->setUrn($report->getEntityUrn())
);
$report->setEntity($entity);
return $report;
}
/**
......
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