From ea09c62dc6bdc04189221e3f6cd1f7958d2fb0d4 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:18:44 -0400 Subject: [PATCH] fix: change default sort for archive to newest-first --- public/api/ajax_pastes.php | 2 +- public/archive.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/api/ajax_pastes.php b/public/api/ajax_pastes.php index b03aa81..4688dc8 100644 --- a/public/api/ajax_pastes.php +++ b/public/api/ajax_pastes.php @@ -30,7 +30,7 @@ if (!empty($_GET['q']) && is_string($_GET['q'])) { }); } -$pastes = $pastes->get(); +$pastes = $pastes->orderBy('id', 'desc')->get(); header('Content-Type: application/json; charset=UTF-8'); diff --git a/public/archive.php b/public/archive.php index b834423..2ff5f44 100644 --- a/public/archive.php +++ b/public/archive.php @@ -45,6 +45,7 @@ if (!empty($filter_value)) { } } +$pastes = $pastes->orderBy('id', 'desc'); $total_results = $pastes->count(); $pastes = $pastes->limit($per_page)->offset($per_page * $current_page);