-
Notifications
You must be signed in to change notification settings - Fork 300
Support subteams that have subteams #1857
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I now support subteams of arbitrary depth. Should I add a #[test] fn
?
src/teams.rs
Outdated
if let TeamKind::Team = team.kind { | ||
let mut team = &team.name; | ||
|
||
// The graph of teams is guaranteed to be acyclic by the the CI script of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true yet but I'm gonna push an update to rust-lang/team#1046 in a sec
result.push(team.clone()); | ||
} | ||
|
||
for subteam in subteams { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super happy about this loop inside this recursive function. Complexity could be better but input size should be relatively low. Let me know if there's a nice way to improve the algorithmic complexity.
let mut subteams = Vec::with_capacity(raw_subteams.len()); | ||
lay_out_subteams_hierarchically(&mut subteams, None, &main_team.name, &raw_subteams); | ||
|
||
fn lay_out_subteams_hierarchically<'a>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're wondering why we need to re-lay out the subteams at all after having fetched all direct and transitive subteams, it's because raw_subteams
is not necessarily ordered hierarchically.
This might sound obvious but in the case of rustdoc and rustdoc-contributors, the original ordering is actually correct (coincidentally) due to the naming of the two teams (them being sorted alphabetically implies being sorted hierarchically as they share the same prefix and the latter is longer).
However, in general this is not the case (the names might not necessarily reflect the hierarchy). Especially if we add weights to the equation: E.g., we don't want to place subsubteams with weight 1000 at the top of the page above everything else (including their parent team!). The weight should be relative to the level / rank / tier. lay_out_subteams_hierarchically
guarantees that.
@Manishearth, do you like this approach of laying out subsubteams (etc.)? Namely arranging them flat on the page of a main team? This design doesn't introduce any new pages or clutter. OTOH, it doesn't allow subteams to have WGs and PGs (see PR description) and it might be confusing to the reader since the hierarchy is not obvious. Alternatively, we could create subpages for subsubteams (etc.) but I don't know how easy it would be to implement and I'm not sure how we would link to them because at the moment the section headers of subteams are already link anchors (and link targets). |
I think that's fine! |
This should show up on www-staging.rust-lang.org in a bit, and after that we should check and see if it works (and then make a PR from main to |
The website shouldn't have changed since neither rust-lang/team#1046 nor rust-lang/team#1040 has been merged yet. |
Yes, but this code will be running and we need to verify it hasn't broken everything before deploy 😄 |
Fixes #1854.
Renders subteams of arbitrary depth.
The "flat design" doesn't allow for subteams to have working groups or project groups since the WGs and PGs are rendered separately below all other teams and therefore can't possibly be placed below their parent team. Therefore I simply don't render them. I'm gonna update rust-lang/team#1046 to disallow such children.
CC @GuillaumeGomez