...
 
Commits (3)
......@@ -173,12 +173,10 @@ class notifications implements Interfaces\Api
/**
* Polyfill notifications to be readed by legacy clients
* @return array
*/
protected function polyfillResponse($notifications)
protected function polyfillResponse($notifications) : array
{
//if (!is_array($notifications)) {
// return $notifications;
// }
$return = [];
// Formatting for legacy notification handling in frontend
foreach ($notifications as $key => $entity) {
......@@ -202,15 +200,15 @@ class notifications implements Interfaces\Api
}
$notification = [
'guid' => $entity->getUUID(),
'uuid' => $entity->getUUID(),
'guid' => $entity->getUuid(),
'uuid' => $entity->getUuid(),
'description' => $data['description'],
'entityObj' => $entityObj ? $entityObj->export() : null,
'filter' => $entity->getType(),
'fromObj' => $fromObj ? $fromObj->export() : null,
'from_guid' => $entity->getFromGuid(),
'to' => $toObj ? $toObj->export() : null,
'guid' => $entity->getUUID(),
'guid' => $entity->getUuid(),
'notification_view' => $entity->getType(),
'params' => $data, // possibly some deeper polyfilling needed here,
'time_created' => $entity->getCreatedTimestamp(),
......
......@@ -5,6 +5,7 @@
namespace Minds\Core\Notification;
use Minds\Core\Data\Cassandra\Client;
use Minds\Core\Di\Di;
use Minds\Common\Repository\Response;
use Cassandra\Bigint;
......@@ -17,7 +18,7 @@ class CassandraRepository
{
const NOTIFICATION_TTL = ((60 * 60) * 24) * 30; // 30 days
/** @var $cql */
/** @var Client $cql */
private $cql;
public function __construct($cql = null, $urn = null)
......@@ -82,8 +83,8 @@ class CassandraRepository
foreach ($result as $row) {
$notification = new Notification();
$notification->setUuid($row['uuid']->uuid() ?: null)
->setToGuid($row['to_guid'] ? (int) $row['to_guid']->value(): null)
->setFromGuid($row['from_guid'] ? (int) $row['from_guid']->value(): null)
->setToGuid(isset($row['to_guid']) ? (int) $row['to_guid']->value() : null)
->setFromGuid(isset($row['from_guid']) ? (int) $row['from_guid']->value() : null)
->setEntityGuid((string) $row['entity_guid']) // REMOVE ONCE FULLY ON CASSANDRA
->setEntityUrn($row['entity_urn'])
->setCreatedTimestamp($row['created_timestamp'] ? $row['created_timestamp']->time() : null)
......