Skip to content

Commit

Permalink
Sort message results by date for all lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-js committed Nov 13, 2024
1 parent 1141475 commit baddd5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions modules/imap/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,11 @@ function merge_imap_search_results($ids, $search_type, $session, $hm_cache, $fol
if (count($sent_results) > 0) {
$msg_list = array_merge($msg_list, $sent_results);
}

usort($msg_list, function($a, $b) {
return strtotime($b['internal_date']) - strtotime($a['internal_date']);
});

return array($status, $msg_list);
}}

Expand Down
4 changes: 0 additions & 4 deletions modules/imap/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,6 @@ public function process() {
$date = process_since_argument($this->user_config->get('all_since_setting', DEFAULT_ALL_SINCE));
}
list($status, $msg_list) = merge_imap_search_results($ids, 'ALL', $this->session, $this->cache, array_map(fn ($folder) => hex2bin($folder), $folders), $limit, array(array('SINCE', $date)));

usort($msg_list, function($a, $b) {
return strtotime($b['internal_date']) - strtotime($a['internal_date']);
});

$this->out('folder_status', $status);
$this->out('imap_combined_inbox_data', $msg_list);
Expand Down

0 comments on commit baddd5c

Please sign in to comment.