From be0098146ca9c4f0c309afb2833de5e4bacc60dd Mon Sep 17 00:00:00 2001 From: Hemant Umre <87542880+HemantUmre12@users.noreply.github.com> Date: Fri, 24 Feb 2023 05:26:50 +0530 Subject: [PATCH] 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. --- static/js/attachments_ui.js | 1 + static/js/list_widget.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/static/js/attachments_ui.js b/static/js/attachments_ui.js index 42d52a09b5..2fe92eab29 100644 --- a/static/js/attachments_ui.js +++ b/static/js/attachments_ui.js @@ -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, }, diff --git a/static/js/list_widget.js b/static/js/list_widget.js index 1687ff2d6f..81aee368a3 100644 --- a/static/js/list_widget.js +++ b/static/js/list_widget.js @@ -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.