Sort results of Notifications::get() by seen status and timestamp
This commit is contained in:
parent
e1970a8636
commit
29bc479355
@ -48,7 +48,7 @@ class Notifications {
|
||||
public static function get(User $user) {
|
||||
global $database, $Strings;
|
||||
if ($user->exists()) {
|
||||
$notifications = $database->select('notifications', ['notificationid (id)', 'timestamp', 'title', 'content', 'url', 'seen', 'sensitive'], ['uid' => $user->getUID()]);
|
||||
$notifications = $database->select('notifications', ['notificationid (id)', 'timestamp', 'title', 'content', 'url', 'seen', 'sensitive'], ['uid' => $user->getUID(), 'ORDER' => ['seen', 'timestamp' => 'DESC']]);
|
||||
for ($i = 0; $i < count($notifications); $i++) {
|
||||
$notifications[$i]['id'] = $notifications[$i]['id'] * 1;
|
||||
$notifications[$i]['seen'] = ($notifications[$i]['seen'] == "1" ? true : false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user