1
+ use crate :: team_data:: TeamClient ;
1
2
use anyhow:: { anyhow, Context } ;
2
3
use async_trait:: async_trait;
3
4
use bytes:: Bytes ;
@@ -240,9 +241,9 @@ impl User {
240
241
. await
241
242
}
242
243
243
- pub async fn is_team_member < ' a > ( & ' a self , client : & ' a GithubClient ) -> anyhow:: Result < bool > {
244
+ pub async fn is_team_member < ' a > ( & ' a self , client : & ' a TeamClient ) -> anyhow:: Result < bool > {
244
245
log:: trace!( "Getting team membership for {:?}" , self . login) ;
245
- let permission = crate :: team_data :: teams ( client ) . await ?;
246
+ let permission = client . teams ( ) . await ?;
246
247
let map = permission. teams ;
247
248
let is_triager = map
248
249
. get ( "wg-triage" )
@@ -262,49 +263,6 @@ impl User {
262
263
}
263
264
}
264
265
265
- // Returns the ID of the given user, if the user is in the `all` team.
266
- pub async fn get_id_for_username (
267
- client : & GithubClient ,
268
- login : & str ,
269
- ) -> anyhow:: Result < Option < u64 > > {
270
- let permission = crate :: team_data:: teams ( client) . await ?;
271
- let map = permission. teams ;
272
- let login = login. to_lowercase ( ) ;
273
- Ok ( map[ "all" ]
274
- . members
275
- . iter ( )
276
- . find ( |g| g. github . to_lowercase ( ) == login)
277
- . map ( |u| u. github_id ) )
278
- }
279
-
280
- pub async fn get_team (
281
- client : & GithubClient ,
282
- team : & str ,
283
- ) -> anyhow:: Result < Option < rust_team_data:: v1:: Team > > {
284
- let permission = crate :: team_data:: teams ( client) . await ?;
285
- let mut map = permission. teams ;
286
- Ok ( map. swap_remove ( team) )
287
- }
288
-
289
- /// Fetches a Rust team via its GitHub team name.
290
- pub async fn get_team_by_github_name (
291
- client : & GithubClient ,
292
- org : & str ,
293
- team : & str ,
294
- ) -> anyhow:: Result < Option < rust_team_data:: v1:: Team > > {
295
- let teams = crate :: team_data:: teams ( client) . await ?;
296
- for rust_team in teams. teams . into_values ( ) {
297
- if let Some ( github) = & rust_team. github {
298
- for gh_team in & github. teams {
299
- if gh_team. org == org && gh_team. name == team {
300
- return Ok ( Some ( rust_team) ) ;
301
- }
302
- }
303
- }
304
- }
305
- Ok ( None )
306
- }
307
-
308
266
#[ derive( PartialEq , Eq , Debug , Clone , serde:: Deserialize ) ]
309
267
pub struct Label {
310
268
pub name : String ,
@@ -2055,10 +2013,11 @@ impl<'q> IssuesQuery for Query<'q> {
2055
2013
repo : & ' a Repository ,
2056
2014
include_fcp_details : bool ,
2057
2015
include_mcp_details : bool ,
2058
- client : & ' a GithubClient ,
2016
+ gh_client : & ' a GithubClient ,
2017
+ team_client : & ' a TeamClient ,
2059
2018
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
2060
2019
let issues = repo
2061
- . get_issues ( & client , self )
2020
+ . get_issues ( & gh_client , self )
2062
2021
. await
2063
2022
. with_context ( || "Unable to get issues." ) ?;
2064
2023
@@ -2071,7 +2030,7 @@ impl<'q> IssuesQuery for Query<'q> {
2071
2030
} ;
2072
2031
2073
2032
let zulip_map = if include_fcp_details {
2074
- Some ( crate :: team_data :: zulip_map ( client ) . await ?)
2033
+ Some ( team_client . zulip_map ( ) . await ?)
2075
2034
} else {
2076
2035
None
2077
2036
} ;
@@ -2101,7 +2060,7 @@ impl<'q> IssuesQuery for Query<'q> {
2101
2060
let fk_initiating_comment = fcp. fcp . fk_initiating_comment ;
2102
2061
let ( initiating_comment_html_url, initiating_comment_content) = {
2103
2062
let comment = issue
2104
- . get_comment ( & client , fk_initiating_comment)
2063
+ . get_comment ( gh_client , fk_initiating_comment)
2105
2064
. await
2106
2065
. with_context ( || {
2107
2066
format ! (
@@ -2166,7 +2125,7 @@ impl<'q> IssuesQuery for Query<'q> {
2166
2125
} ;
2167
2126
2168
2127
let mcp_details = if include_mcp_details {
2169
- let first100_comments = issue. get_first100_comments ( & client ) . await ?;
2128
+ let first100_comments = issue. get_first100_comments ( & gh_client ) . await ?;
2170
2129
let ( zulip_link, concerns) = if !first100_comments. is_empty ( ) {
2171
2130
let split = re_zulip_link
2172
2131
. split ( & first100_comments[ 0 ] . body )
@@ -2881,7 +2840,8 @@ pub trait IssuesQuery {
2881
2840
repo : & ' a Repository ,
2882
2841
include_fcp_details : bool ,
2883
2842
include_mcp_details : bool ,
2884
- client : & ' a GithubClient ,
2843
+ gh_client : & ' a GithubClient ,
2844
+ team_client : & ' a TeamClient ,
2885
2845
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > ;
2886
2846
}
2887
2847
@@ -2894,6 +2854,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
2894
2854
_include_fcp_details : bool ,
2895
2855
_include_mcp_details : bool ,
2896
2856
client : & ' a GithubClient ,
2857
+ _team_client : & ' a TeamClient ,
2897
2858
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
2898
2859
use cynic:: QueryBuilder ;
2899
2860
use github_graphql:: queries;
@@ -3112,6 +3073,7 @@ impl IssuesQuery for DesignMeetings {
3112
3073
_include_fcp_details : bool ,
3113
3074
_include_mcp_details : bool ,
3114
3075
client : & ' a GithubClient ,
3076
+ _team_client : & ' a TeamClient ,
3115
3077
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
3116
3078
use github_graphql:: project_items:: ProjectV2ItemContent ;
3117
3079
0 commit comments