mirror of
https://github.com/kevachat/geminiapp.git
synced 2025-03-13 05:51:39 +00:00
sort messages by timestamp desc
This commit is contained in:
parent
d09f940f4b
commit
55ffa4634a
@ -147,12 +147,15 @@ class Room
|
|||||||
|
|
||||||
foreach ($records as $record)
|
foreach ($records as $record)
|
||||||
{
|
{
|
||||||
if ($post = $this->post($namespace, $record['key'], $records))
|
if ($post = $this->post($namespace, $record['key'], $records, null, $time))
|
||||||
{
|
{
|
||||||
$posts[] = $post;
|
$posts[$time] = $post;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort posts by time
|
||||||
|
krsort($posts);
|
||||||
|
|
||||||
// Get subject
|
// Get subject
|
||||||
$subject = null;
|
$subject = null;
|
||||||
|
|
||||||
@ -187,7 +190,7 @@ class Room
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function post(string $namespace, string $key, array $posts = [], ?string $field = null): ?string
|
public function post(string $namespace, string $key, array $posts = [], ?string $field = null, ?int &$time = 0): ?string
|
||||||
{
|
{
|
||||||
// Check record exists
|
// Check record exists
|
||||||
if (!$record = (array) $this->_kevacoin->kevaGet($namespace, $key))
|
if (!$record = (array) $this->_kevacoin->kevaGet($namespace, $key))
|
||||||
@ -271,6 +274,9 @@ class Room
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return timestamp
|
||||||
|
$time = $matches[1];
|
||||||
|
|
||||||
// Build final view and send to response
|
// Build final view and send to response
|
||||||
return str_replace(
|
return str_replace(
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user