settings: Sort Uploaded files with newest on top.

When a user opens the [Setting > Uploaded files] initially in the
'Data Uploaded' column, files are sorted from oldest to newest.
Instead, sorting this panel from newest to oldest. Because it's
more likely that the user is interested in their recently uploaded
files, e.g. if they uploaded something by accident.

Fixes #23737.
This commit is contained in:
Hemant Umre 2023-02-24 05:26:50 +05:30 committed by GitHub
parent ff865368c5
commit be0098146c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -108,6 +108,7 @@ function render_attachments_ui() {
},
$parent_container: $("#attachments-settings").expectOne(),
init_sort: ["numeric", "create_time"],
initially_descending_sort: true,
sort_fields: {
mentioned_in: sort_mentioned_in,
},

View File

@ -443,6 +443,11 @@ export function create($container, list, opts) {
widget.set_sorting_function(...opts.init_sort);
}
if (opts.initially_descending_sort) {
widget.set_reverse_mode(true);
opts.$simplebar_container.find(".active").addClass("descend");
}
widget.clean_redraw();
// Save the instance for potential future retrieval if a name is provided.