-
Notifications
You must be signed in to change notification settings - Fork 291
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
Add fallback for role descriptions #1905
Conversation
CI failure is fixed by #1906. |
Rebased on #1906. |
src/i18n.rs
Outdated
return role["description"].as_str().unwrap(); | ||
} | ||
} | ||
panic!("no role {:?}", role_id); |
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.
issue: let's fail gracefully; I don't want the website to crash whenever the teams repo is updated
I'd just have it output the role ID
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.
I don't think this would crash on a team repo update — the JSON looks like this:
{
"name": "spec",
"members": [
...
{
"name": "Joel Marcey",
"github": "JoelMarcey",
"roles": [
"spec-editor"
]
}
],
"website_data": {
"name": "Specification team",
"description": "Creating and maintaining the specification for the Rust language",
"page": "spec",
...
},
"roles": [
{
"id": "spec-editor",
"description": "Editor"
}
]
}
where .members.*.roles.*
are guaranteed to line up with exactly one .roles.*.id
.
There is a test here to enforce it:
The static-api teams.json cannot be published without that validation passing.
We can make this more robust to broken teams.json but all the other unwraps in this code would also be crashable in that situation.
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.
Changed to return role_id, with a comment saying it should be unreachable.
CI failure is fixed by #1910. |
Followup to #1904. Just as already done for team names and team descriptions, if a new role is added in the rust-lang/team repo, www will render it using the en-US text supplied in teams.json until translations appear in this repo.
Before:
After: