Skip to content

Commit 3ea663a

Browse files
authored
Merge pull request #1670 from mercihabam/fix-sort-page
fix(frontend): keep track keep track of current page number when sorting, and display correct sort value when reloading
2 parents 175b5cb + edea7d8 commit 3ea663a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

modules/core/handler_modules.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ class Hm_Handler_default_sort_order_setting extends Hm_Handler_Module {
230230
*/
231231
public function process() {
232232
$this->out('default_sort_order', $this->user_config->get('default_sort_order_setting', 'arrival'));
233-
$this->out('sort', $this->request->get['sort'] ?? null);
234-
$this->out('list_sort', $this->request->get['list_sort'] ?? null);
233+
$this->out('list_sort', $this->request->get['sort'] ?? null);
235234
}
236235
}
237236

modules/core/js_modules/actions/pagination.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function nextPage() {
2727
}
2828

2929
async function previousPage() {
30-
const currentPage = $(".pagination .current:first").text();
30+
const currentPage = $(".pagination .current").first().text();
3131

3232
const previousPage = parseInt(currentPage) - 1;
3333

modules/core/message_list_functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ function combined_sort_dialog($mod) {
145145

146146
$res = '<select name="sort" style="width: 150px" class="combined_sort form-select form-select-sm ms-2">';
147147
foreach ($sorts as $name => $val) {
148-
$res .= '<option value="'.$name.'"'.($mod->get('sort') == $name || $mod->get('list_sort') == $name ? ' selected' : '').'>'.$val.' &darr;</option>';
149-
$res .= '<option value="-'.$name.'"'.($mod->get('sort') == '-'.$name || $mod->get('list_sort') == '-'.$name ? ' selected' : '').'>'.$val.' &uarr;</option>';
148+
$res .= '<option value="'.$name.'"'.($mod->get('list_sort') == $name ? ' selected' : '').'>'.$val.' &darr;</option>';
149+
$res .= '<option value="-'.$name.'"'.($mod->get('list_sort') == '-'.$name ? ' selected' : '').'>'.$val.' &uarr;</option>';
150150
}
151151
$res .= '</select>';
152152
return $res;

modules/imap/output_modules.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected function output() {
3838
$custom = '<form id="imap_filter_form" method="GET" class="d-flex align-content-center">';
3939
$custom .= '<input type="hidden" name="page" value="message_list" />';
4040
$custom .= '<input type="hidden" name="list_path" value="'.$this->html_safe($this->get('list_path')).'" />';
41+
$custom .= '<input type="hidden" name="list_page" value="'.$this->html_safe($this->get('list_page')).'" />';
4142
$custom .= '<input type="search" placeholder="'.$this->trans('Search').
4243
'" class="imap_keyword form-control form-control-sm" name="keyword" value="'.$this->html_safe($keyword).'" />';
4344
$custom .= '<select name="sort" class="imap_sort form-control form-control-sm">';

0 commit comments

Comments
 (0)