Commit eaa63ddc authored by Mark Harding's avatar Mark Harding

(fix): very hacky fix due to 18 digits ids ticking over to 10s

parent 4a12a7d8
No related merge requests found
Pipeline #72312614 running with stages
......@@ -36,16 +36,25 @@ class Messages
return $this;
}
public function getMessages($limit = 12, $offset = "", $finish = "")
public function getMessages($limit = 12, $offset = "", $finish = "", $idFix = false)
{
$this->conversation->setGuid(null); //legacy messages get confused here
$guid = $this->conversation->getGuid();
$cassandraOffset = $offset;
if ($cassandraOffset) {
$idFix = true;
}
if (!$idFix) {
$cassandraOffset = "1900076691505463296";
}
$opts = [
'limit' => $limit,
'offset'=> $offset,
'offset'=> $cassandraOffset,
'finish'=> $finish,
'reversed'=> true
'reversed'=> true,
];
$messages = $this->indexes->get("object:gathering:conversation:$guid", $opts) ?: [];
......@@ -62,6 +71,13 @@ class Messages
}
}
if ((!$idFix || (int) $cassandraOffset > 999999999999999999) && count($messages) < $limit) {
$olderEntities = $this->getMessages($limit - count($messages), $offset, "", true);
foreach ($olderEntities as $guid => $entity) {
$entities[$guid] = $entity;
}
}
return $entities;
}
}
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