You've already forked AstralRinth
forked from didirus/AstralRinth
FlameAnvil Project Sync (#481)
* FlameAnvil Project Sync * Perm fixes * Fix compile * Fix clippy + run prepare
This commit is contained in:
@@ -89,6 +89,11 @@ pub struct Project {
|
||||
|
||||
/// A string of URLs to visual content featuring the project
|
||||
pub gallery: Vec<GalleryItem>,
|
||||
|
||||
/// The project linked from FlameAnvil to sync with
|
||||
pub flame_anvil_project: Option<i32>,
|
||||
/// The user_id of the team member whose token
|
||||
pub flame_anvil_user: Option<UserId>,
|
||||
}
|
||||
|
||||
impl From<QueryProject> for Project {
|
||||
@@ -153,6 +158,8 @@ impl From<QueryProject> for Project {
|
||||
created: x.created,
|
||||
})
|
||||
.collect(),
|
||||
flame_anvil_project: m.flame_anvil_project,
|
||||
flame_anvil_user: m.flame_anvil_user.map(|x| x.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,16 @@ pub struct TeamMember {
|
||||
|
||||
impl TeamMember {
|
||||
pub fn from(data: QueryTeamMember, override_permissions: bool) -> Self {
|
||||
let has_flame_anvil_key = data.user.flame_anvil_key.is_some();
|
||||
let mut user: User = data.user.into();
|
||||
|
||||
if !override_permissions {
|
||||
user.has_flame_anvil_key = Some(has_flame_anvil_key);
|
||||
}
|
||||
|
||||
Self {
|
||||
team_id: data.team_id.into(),
|
||||
user: data.user.into(),
|
||||
user,
|
||||
role: data.role,
|
||||
permissions: if override_permissions {
|
||||
None
|
||||
|
||||
@@ -47,6 +47,7 @@ pub struct User {
|
||||
pub role: Role,
|
||||
pub badges: Badges,
|
||||
pub payout_data: Option<UserPayoutData>,
|
||||
pub has_flame_anvil_key: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
@@ -140,6 +141,7 @@ impl From<DBUser> for User {
|
||||
role: Role::from_string(&data.role),
|
||||
badges: data.badges,
|
||||
payout_data: None,
|
||||
has_flame_anvil_key: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user