Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions docs/toml-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ email = "john@doe.com" # Email address used for mailing lists (optional)
irc = "jdoe" # Nickname of the person on IRC, if different than the GitHub one (optional)
matrix = "@john:doe.com" # Matrix username (MXID) of the person (optional)

[funding]
# Optional, specify that you have GitHub Sponsors enabled and you
# are looking for sponsors to fund your work on Rust.
github-sponsors = true

[permissions]
# Optional, see the permissions documentation
```
Expand Down
1 change: 1 addition & 0 deletions rust_team_data/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ pub struct Person {
pub name: String,
pub email: Option<String>,
pub github_id: u64,
pub github_sponsors: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
Expand Down
12 changes: 12 additions & 0 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ pub(crate) enum Email<'a> {
Present(&'a str),
}

#[derive(serde_derive::Deserialize, Debug, Default)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
pub(crate) struct Funding {
github_sponsors: bool,
}

#[derive(serde_derive::Deserialize, Debug)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
pub(crate) struct Person {
Expand All @@ -78,6 +84,8 @@ pub(crate) struct Person {
discord_id: Option<u64>,
matrix: Option<String>,
#[serde(default)]
funding: Funding,
#[serde(default)]
permissions: Permissions,
}

Expand All @@ -98,6 +106,10 @@ impl Person {
self.zulip_id
}

pub(crate) fn has_github_sponsors(&self) -> bool {
self.funding.github_sponsors
}

#[allow(unused)]
pub(crate) fn irc(&self) -> &str {
if let Some(irc) = &self.irc {
Expand Down
1 change: 1 addition & 0 deletions src/static_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ impl<'a> Generator<'a> {
Email::Present(s) => Some(s.into()),
},
github_id: person.github_id(),
github_sponsors: person.has_github_sponsors(),
},
);
}
Expand Down
1 change: 1 addition & 0 deletions sync-team/src/github/tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl DataModel {
name: name.to_string(),
email: Some(format!("{name}@rust.com")),
github_id,
github_sponsors: false,
});
github_id
}
Expand Down
24 changes: 16 additions & 8 deletions tests/static-api/_expected/v1/people.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,50 @@
"test-admin": {
"name": "Test Admin",
"email": "test-admin@example.com",
"github_id": 7
"github_id": 7,
"github_sponsors": false
},
"user-0": {
"name": "Zeroth user",
"email": "user0@example.com",
"github_id": 0
"github_id": 0,
"github_sponsors": false
},
"user-1": {
"name": "First user",
"email": "user1@example.com",
"github_id": 0
"github_id": 0,
"github_sponsors": false
},
"user-2": {
"name": "Second user",
"email": "user2@example.com",
"github_id": 2
"github_id": 2,
"github_sponsors": false
},
"user-3": {
"name": "Third user",
"email": "user3@example.com",
"github_id": 3
"github_id": 3,
"github_sponsors": false
},
"user-4": {
"name": "Fourth user",
"email": "user4@example.com",
"github_id": 4
"github_id": 4,
"github_sponsors": false
},
"user-5": {
"name": "Fifth user",
"email": "user5@example.com",
"github_id": 5
"github_id": 5,
"github_sponsors": false
},
"user-6": {
"name": "Sixth user",
"email": "user6@example.com",
"github_id": 6
"github_id": 6,
"github_sponsors": false
}
}
}