Skip to content

Commit 4fea82a

Browse files
authored
Include en-US description of custom roles in static API (#1181)
* Include en-US description of custom roles in static API * Add a custom role to static-api test
1 parent 3161442 commit 4fea82a

File tree

9 files changed

+50
-3
lines changed

9 files changed

+50
-3
lines changed

rust_team_data/src/v1.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub struct Team {
2323
pub alumni: Vec<TeamMember>,
2424
pub github: Option<TeamGitHub>,
2525
pub website_data: Option<TeamWebsite>,
26+
pub roles: Vec<MemberRole>,
2627
pub discord: Vec<TeamDiscord>,
2728
}
2829

@@ -60,6 +61,12 @@ pub struct TeamWebsite {
6061
pub weight: i64,
6162
}
6263

64+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
65+
pub struct MemberRole {
66+
pub id: String,
67+
pub description: String,
68+
}
69+
6370
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
6471
pub struct TeamDiscord {
6572
pub name: String,

src/static_api.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ impl<'a> Generator<'a> {
189189
zulip_stream: ws.zulip_stream().map(|s| s.into()),
190190
weight: ws.weight(),
191191
}),
192+
roles: team
193+
.roles()
194+
.iter()
195+
.map(|role| v1::MemberRole {
196+
id: role.id.clone(),
197+
description: role.description.clone(),
198+
})
199+
.collect(),
192200
discord: team
193201
.discord_roles()
194202
.map(|roles| {

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"alumni": [],
1515
"github": null,
1616
"website_data": null,
17+
"roles": [],
1718
"discord": []
1819
},
1920
"foo": {
@@ -69,6 +70,7 @@
6970
"zulip_stream": "t-foo",
7071
"weight": 1000
7172
},
73+
"roles": [],
7274
"discord": []
7375
},
7476
"leaderless": {
@@ -86,6 +88,7 @@
8688
"alumni": [],
8789
"github": null,
8890
"website_data": null,
91+
"roles": [],
8992
"discord": []
9093
},
9194
"leads-permissions": {
@@ -115,6 +118,7 @@
115118
"alumni": [],
116119
"github": null,
117120
"website_data": null,
121+
"roles": [],
118122
"discord": []
119123
},
120124
"wg-test": {
@@ -126,7 +130,10 @@
126130
"name": "Second user",
127131
"github": "user-2",
128132
"github_id": 2,
129-
"is_lead": true
133+
"is_lead": true,
134+
"roles": [
135+
"convener"
136+
]
130137
}
131138
],
132139
"alumni": [
@@ -145,6 +152,12 @@
145152
],
146153
"github": null,
147154
"website_data": null,
155+
"roles": [
156+
{
157+
"id": "convener",
158+
"description": "Convener"
159+
}
160+
],
148161
"discord": []
149162
}
150163
}

tests/static-api/_expected/v1/teams/alumni.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"alumni": [],
1414
"github": null,
1515
"website_data": null,
16+
"roles": [],
1617
"discord": []
1718
}

tests/static-api/_expected/v1/teams/foo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
"zulip_stream": "t-foo",
5252
"weight": 1000
5353
},
54+
"roles": [],
5455
"discord": []
5556
}

tests/static-api/_expected/v1/teams/leaderless.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"alumni": [],
1414
"github": null,
1515
"website_data": null,
16+
"roles": [],
1617
"discord": []
1718
}

tests/static-api/_expected/v1/teams/leads-permissions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"alumni": [],
2626
"github": null,
2727
"website_data": null,
28+
"roles": [],
2829
"discord": []
2930
}

tests/static-api/_expected/v1/teams/wg-test.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"name": "Second user",
88
"github": "user-2",
99
"github_id": 2,
10-
"is_lead": true
10+
"is_lead": true,
11+
"roles": [
12+
"convener"
13+
]
1114
}
1215
],
1316
"alumni": [
@@ -26,5 +29,11 @@
2629
],
2730
"github": null,
2831
"website_data": null,
32+
"roles": [
33+
{
34+
"id": "convener",
35+
"description": "Convener"
36+
}
37+
],
2938
"discord": []
3039
}

tests/static-api/teams/wg-test.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ kind = "working-group"
33

44
[people]
55
leads = ["user-2"]
6-
members = ["user-2"]
6+
members = [
7+
{ github = "user-2", roles = ["convener"] },
8+
]
79
alumni = ["user-0", "user-5"]
10+
11+
[[roles]]
12+
id = "convener"
13+
description = "Convener"

0 commit comments

Comments
 (0)