diff --git a/core/imageboard/image.php b/core/imageboard/image.php index 7dc45712..fa54edd3 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -357,8 +357,9 @@ class Image '); } else { $tags[] = 'id'. $gtlt . $this->id; + $tags[] = 'order:id_'. strtolower($dir); $querylet = Image::build_search_querylet($tags); - $querylet->append_sql(' ORDER BY images.id '.$dir.' LIMIT 1'); + $querylet->append_sql(' LIMIT 1'); $row = $database->get_row($querylet->sql, $querylet->variables); } diff --git a/ext/view/test.php b/ext/view/test.php index 797429b4..9087b0f9 100644 --- a/ext/view/test.php +++ b/ext/view/test.php @@ -43,10 +43,10 @@ class ViewImageTest extends ShimmiePHPUnitTestCase // When searching, we skip the middle $page = $this->get_page("post/prev/$image_id_1", ["search"=>"test"]); - $this->assertEquals("/test/post/view/$image_id_3", $page->redirect); + $this->assertEquals("/test/post/view/$image_id_3?#search=test", $page->redirect); $page = $this->get_page("post/next/$image_id_3", ["search"=>"test"]); - $this->assertEquals("/test/post/view/$image_id_1", $page->redirect); + $this->assertEquals("/test/post/view/$image_id_1?#search=test", $page->redirect); // Middle image: has next and prev $page = $this->get_page("post/next/$image_id_2");