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:
Geometrically
2024-01-04 16:24:33 -05:00
committed by GitHub
parent cf9c8cbb4f
commit f5802fee31
36 changed files with 322 additions and 246 deletions

View File

@@ -73,7 +73,7 @@ pub enum CreateError {
InvalidCategory(String),
#[error("Invalid file type for version file: {0}")]
InvalidFileType(String),
#[error("Slug collides with other project's id!")]
#[error("Slug is already taken!")]
SlugCollision,
#[error("Authentication Error: {0}")]
Unauthorized(#[from] AuthenticationError),
@@ -612,22 +612,22 @@ async fn project_create_inner(
additional_categories.extend(ids.values());
}
// Should only be owner if not attached to an organization
let is_owner = project_create_data.organization_id.is_none();
let mut members = vec![];
let team = models::team_item::TeamBuilder {
members: vec![models::team_item::TeamMemberBuilder {
if project_create_data.organization_id.is_none() {
members.push(models::team_item::TeamMemberBuilder {
user_id: current_user.id.into(),
role: crate::models::teams::OWNER_ROLE.to_owned(),
is_owner,
// Allow all permissions for project creator, even if attached to a project
is_owner: true,
permissions: ProjectPermissions::all(),
organization_permissions: None,
accepted: true,
payouts_split: Decimal::ONE_HUNDRED,
ordering: 0,
}],
};
})
}
let team = models::team_item::TeamBuilder { members };
let team_id = team.insert(&mut *transaction).await?;