Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow people to only be extra people in a Zulip group #1124

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,35 @@ fn validate_inactive_members(data: &Data, errors: &mut Vec<String>) {
.flat_map(|r| r.access.individuals.keys())
.map(|n| n.as_str())
.collect::<HashSet<_>>();
let zulip_groups = match data.zulip_groups() {
Ok(z) => z,
Err(e) => {
errors.push(format!("could not get all the Zulip groups: {e}"));
return;
}
};
// All people in that are included in a Zulip group which can contain people not in all_members
let all_extra_zulip_people = zulip_groups
.values()
.flat_map(|z| z.members())
.filter_map(|m| match m {
ZulipGroupMember::MemberWithId { github, .. }
| ZulipGroupMember::MemberWithoutId { github } => Some(github.as_str()),
ZulipGroupMember::JustId(_) => None,
})
.collect::<HashSet<_>>();
wrapper(
all_members.difference(&referenced_members),
errors,
|person, _| {
if !data.person(person).unwrap().permissions().has_any() && !all_ics.contains(person) {
if !data.person(person).unwrap().permissions().has_any()
&& !all_ics.contains(person)
&& !all_extra_zulip_people.contains(person)
{
bail!(
"person `{}` is not a member of any team (active or archived), has no permissions, and is not an individual contributor to any repo",
person
"person `{person}` is not a member of any team (active or archived), \
has no permissions, is not an individual contributor to any repo, and \
is not included as a extra person in a Zulip group",
);
}
Ok(())
Expand Down