Skip to content

Commit ee5fe4d

Browse files
committed
Make it possible to document usage of GitHub Sponsors
1 parent 2a65ad8 commit ee5fe4d

File tree

6 files changed

+36
-8
lines changed

6 files changed

+36
-8
lines changed

docs/toml-schema.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ email = "[email protected]" # Email address used for mailing lists (optional)
1717
irc = "jdoe" # Nickname of the person on IRC, if different than the GitHub one (optional)
1818
matrix = "@john:doe.com" # Matrix username (MXID) of the person (optional)
1919

20+
[funding]
21+
# Optional, specify that you have GitHub Sponsors enabled and you
22+
# are looking for sponsors to fund your work on Rust.
23+
github-sponsors = true
24+
2025
[permissions]
2126
# Optional, see the permissions documentation
2227
```

rust_team_data/src/v1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ pub struct Person {
249249
pub name: String,
250250
pub email: Option<String>,
251251
pub github_id: u64,
252+
pub github_sponsors: bool,
252253
}
253254

254255
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]

src/schema.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ pub(crate) enum Email<'a> {
6565
Present(&'a str),
6666
}
6767

68+
#[derive(serde_derive::Deserialize, Debug, Default)]
69+
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
70+
pub(crate) struct Funding {
71+
github_sponsors: bool,
72+
}
73+
6874
#[derive(serde_derive::Deserialize, Debug)]
6975
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
7076
pub(crate) struct Person {
@@ -78,6 +84,8 @@ pub(crate) struct Person {
7884
discord_id: Option<u64>,
7985
matrix: Option<String>,
8086
#[serde(default)]
87+
funding: Funding,
88+
#[serde(default)]
8189
permissions: Permissions,
8290
}
8391

@@ -98,6 +106,10 @@ impl Person {
98106
self.zulip_id
99107
}
100108

109+
pub(crate) fn has_github_sponsors(&self) -> bool {
110+
self.funding.github_sponsors
111+
}
112+
101113
#[allow(unused)]
102114
pub(crate) fn irc(&self) -> &str {
103115
if let Some(irc) = &self.irc {

src/static_api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ impl<'a> Generator<'a> {
367367
Email::Present(s) => Some(s.into()),
368368
},
369369
github_id: person.github_id(),
370+
github_sponsors: person.has_github_sponsors(),
370371
},
371372
);
372373
}

sync-team/src/github/tests/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl DataModel {
3939
name: name.to_string(),
4040
email: Some(format!("{name}@rust.com")),
4141
github_id,
42+
github_sponsors: false,
4243
});
4344
github_id
4445
}

tests/static-api/_expected/v1/people.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,50 @@
33
"test-admin": {
44
"name": "Test Admin",
55
"email": "[email protected]",
6-
"github_id": 7
6+
"github_id": 7,
7+
"github_sponsors": false
78
},
89
"user-0": {
910
"name": "Zeroth user",
1011
"email": "[email protected]",
11-
"github_id": 0
12+
"github_id": 0,
13+
"github_sponsors": false
1214
},
1315
"user-1": {
1416
"name": "First user",
1517
"email": "[email protected]",
16-
"github_id": 0
18+
"github_id": 0,
19+
"github_sponsors": false
1720
},
1821
"user-2": {
1922
"name": "Second user",
2023
"email": "[email protected]",
21-
"github_id": 2
24+
"github_id": 2,
25+
"github_sponsors": false
2226
},
2327
"user-3": {
2428
"name": "Third user",
2529
"email": "[email protected]",
26-
"github_id": 3
30+
"github_id": 3,
31+
"github_sponsors": false
2732
},
2833
"user-4": {
2934
"name": "Fourth user",
3035
"email": "[email protected]",
31-
"github_id": 4
36+
"github_id": 4,
37+
"github_sponsors": false
3238
},
3339
"user-5": {
3440
"name": "Fifth user",
3541
"email": "[email protected]",
36-
"github_id": 5
42+
"github_id": 5,
43+
"github_sponsors": false
3744
},
3845
"user-6": {
3946
"name": "Sixth user",
4047
"email": "[email protected]",
41-
"github_id": 6
48+
"github_id": 6,
49+
"github_sponsors": false
4250
}
4351
}
4452
}

0 commit comments

Comments
 (0)