diff --git a/src/schema.rs b/src/schema.rs index be2a524da..7607f313f 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -308,18 +308,14 @@ impl Team { let alumni = data .teams() .chain(data.archived_teams()) - .flat_map(|t| t.alumni()) - .map(|a| a.as_str()) + .flat_map(|t| t.explicit_alumni()) + .map(|a| a.github.as_str()) .filter(|person| !active_members.contains(person)); members.extend(alumni); } Ok(members) } - pub(crate) fn alumni(&self) -> &[String] { - self.people.alumni.as_ref().map_or(&[], Vec::as_slice) - } - pub(crate) fn raw_lists(&self) -> &[TeamList] { &self.lists } @@ -478,6 +474,10 @@ impl Team { &self.people.members } + pub(crate) fn explicit_alumni(&self) -> &[TeamMember] { + self.people.alumni.as_ref().map_or(&[], Vec::as_slice) + } + pub(crate) fn contains_person(&self, data: &Data, person: &Person) -> Result { let members = self.members(data)?; Ok(members.contains(person.github())) @@ -525,7 +525,7 @@ impl std::cmp::Ord for GitHubTeam<'_> { pub(crate) struct TeamPeople { pub leads: Vec, pub members: Vec, - pub alumni: Option>, + pub alumni: Option>, #[serde(default)] pub included_teams: Vec, #[serde(default = "default_false")] diff --git a/src/static_api.rs b/src/static_api.rs index e71d93363..5c093e1f6 100644 --- a/src/static_api.rs +++ b/src/static_api.rs @@ -147,6 +147,9 @@ impl<'a> Generator<'a> { for member in team.explicit_members().iter().cloned() { website_roles.insert(member.github, member.roles); } + for alum in team.explicit_alumni().iter().cloned() { + website_roles.insert(alum.github, alum.roles); + } let leads = team.leads(); let mut members = Vec::new(); @@ -165,14 +168,17 @@ impl<'a> Generator<'a> { members.sort_by_key(|member| !member.is_lead); let mut alumni = Vec::new(); - for github_name in team.alumni() { - if let Some(person) = self.data.person(github_name) { + for alum in team.explicit_alumni() { + if let Some(person) = self.data.person(&alum.github) { alumni.push(v1::TeamMember { name: person.name().into(), - github: github_name.to_string(), + github: alum.github.to_string(), github_id: person.github_id(), is_lead: false, - roles: Vec::new(), + roles: website_roles + .get(alum.github.as_str()) + .cloned() + .unwrap_or_default(), }); } } diff --git a/src/validate.rs b/src/validate.rs index bf30253cd..0afe6010d 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -304,8 +304,8 @@ fn validate_inactive_members(data: &Data, errors: &mut Vec) { for member in members { referenced_members.insert(member); } - for person in team.alumni() { - referenced_members.insert(person); + for person in team.explicit_alumni() { + referenced_members.insert(person.github.as_str()); } for list in team.raw_lists() { for person in &list.extra_people {