From aee9b6a951aeb1e38c700889ad8efde898f49594 Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Sun, 7 Jan 2024 15:08:28 -0500 Subject: [PATCH] Fix Plugin/Datapack creation and featuring (#836) --- src/routes/v2/tags.rs | 6 ++++++ src/routes/v3/versions.rs | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/routes/v2/tags.rs b/src/routes/v2/tags.rs index 7d1fcfee..cf8cb501 100644 --- a/src/routes/v2/tags.rs +++ b/src/routes/v2/tags.rs @@ -90,6 +90,12 @@ pub async fn loader_list( supported_project_types.push("modpack".to_string()); } + if supported_project_types.contains(&"datapack".to_string()) + || supported_project_types.contains(&"plugin".to_string()) + { + supported_project_types.push("mod".to_string()); + } + LoaderData { icon: l.icon, name: l.name, diff --git a/src/routes/v3/versions.rs b/src/routes/v3/versions.rs index fc9acb1e..01c80929 100644 --- a/src/routes/v3/versions.rs +++ b/src/routes/v3/versions.rs @@ -773,7 +773,7 @@ pub async fn version_list( .cloned() .collect::>(); - versions.sort(); + versions.sort_by(|a, b| b.inner.date_published.cmp(&a.inner.date_published)); // Attempt to populate versions with "auto featured" versions if response.is_empty() && !versions.is_empty() && filters.featured.unwrap_or(false) { @@ -823,8 +823,7 @@ pub async fn version_list( } } - response.sort(); - response.reverse(); + response.sort_by(|a, b| b.inner.date_published.cmp(&a.inner.date_published)); response.dedup_by(|a, b| a.inner.id == b.inner.id); let response = filter_visible_versions(response, &user_option, &pool, &redis).await?;