You've already forked AstralRinth
forked from didirus/AstralRinth
Staging bug fixes (#819)
* Staging bug fixes * Finish fixes * fix tests * Update migration * Update migrations * fix side types being added for ineligible loaders * fix tests * Fix tests * Finish fixes * Add slug display names
This commit is contained in:
@@ -83,24 +83,23 @@ impl LegacyProject {
|
||||
let mut game_versions = Vec::new();
|
||||
|
||||
// V2 versions only have one project type- v3 versions can rarely have multiple.
|
||||
// We'll prioritize 'modpack' first, then 'mod', and if neither are found, use the first one.
|
||||
// We'll prioritize 'modpack' first, and if neither are found, use the first one.
|
||||
// If there are no project types, default to 'project'
|
||||
let mut project_types = data.project_types;
|
||||
if project_types.contains(&"modpack".to_string()) {
|
||||
project_types = vec!["modpack".to_string()];
|
||||
} else if project_types.contains(&"mod".to_string()) {
|
||||
project_types = vec!["mod".to_string()];
|
||||
}
|
||||
let project_type = project_types
|
||||
|
||||
let og_project_type = project_types
|
||||
.first()
|
||||
.cloned()
|
||||
.unwrap_or("project".to_string()); // Default to 'project' if none are found
|
||||
|
||||
let mut project_type = if project_type == "datapack" || project_type == "plugin" {
|
||||
let mut project_type = if og_project_type == "datapack" || og_project_type == "plugin" {
|
||||
// These are not supported in V2, so we'll just use 'mod' instead
|
||||
"mod".to_string()
|
||||
} else {
|
||||
project_type
|
||||
og_project_type.clone()
|
||||
};
|
||||
|
||||
let mut loaders = data.loaders;
|
||||
@@ -120,7 +119,8 @@ impl LegacyProject {
|
||||
.iter()
|
||||
.map(|f| (f.field_name.clone(), f.value.clone().serialize_internal()))
|
||||
.collect::<HashMap<_, _>>();
|
||||
(client_side, server_side) = v2_reroute::convert_side_types_v2(&fields);
|
||||
(client_side, server_side) =
|
||||
v2_reroute::convert_side_types_v2(&fields, Some(&*og_project_type));
|
||||
|
||||
// - if loader is mrpack, this is a modpack
|
||||
// the loaders are whatever the corresponding loader fields are
|
||||
|
||||
@@ -75,24 +75,22 @@ impl LegacyResultSearchProject {
|
||||
display_categories.dedup();
|
||||
|
||||
// V2 versions only have one project type- v3 versions can rarely have multiple.
|
||||
// We'll prioritize 'modpack' first, then 'mod', and if neither are found, use the first one.
|
||||
// We'll prioritize 'modpack' first, and if neither are found, use the first one.
|
||||
// If there are no project types, default to 'project'
|
||||
let mut project_types = result_search_project.project_types;
|
||||
if project_types.contains(&"modpack".to_string()) {
|
||||
project_types = vec!["modpack".to_string()];
|
||||
} else if project_types.contains(&"mod".to_string()) {
|
||||
project_types = vec!["mod".to_string()];
|
||||
}
|
||||
let project_type = project_types
|
||||
let og_project_type = project_types
|
||||
.first()
|
||||
.cloned()
|
||||
.unwrap_or("project".to_string()); // Default to 'project' if none are found
|
||||
|
||||
let project_type = if project_type == "datapack" || project_type == "plugin" {
|
||||
let project_type = if og_project_type == "datapack" || og_project_type == "plugin" {
|
||||
// These are not supported in V2, so we'll just use 'mod' instead
|
||||
"mod".to_string()
|
||||
} else {
|
||||
project_type
|
||||
og_project_type.clone()
|
||||
};
|
||||
|
||||
let loader_fields = result_search_project.loader_fields.clone();
|
||||
@@ -115,6 +113,7 @@ impl LegacyResultSearchProject {
|
||||
client_only,
|
||||
server_only,
|
||||
client_and_server,
|
||||
Some(&*og_project_type),
|
||||
);
|
||||
let client_side = client_side.to_string();
|
||||
let server_side = server_side.to_string();
|
||||
|
||||
@@ -15,6 +15,8 @@ pub struct OrganizationId(pub u64);
|
||||
pub struct Organization {
|
||||
/// The id of the organization
|
||||
pub id: OrganizationId,
|
||||
/// The slug of the organization
|
||||
pub slug: String,
|
||||
/// The title (and slug) of the organization
|
||||
pub name: String,
|
||||
/// The associated team of the organization
|
||||
@@ -38,6 +40,7 @@ impl Organization {
|
||||
) -> Self {
|
||||
Self {
|
||||
id: data.id.into(),
|
||||
slug: data.slug,
|
||||
name: data.name,
|
||||
team_id: data.team_id.into(),
|
||||
description: data.description,
|
||||
|
||||
Reference in New Issue
Block a user