1+ use crate :: team_data:: TeamClient ;
12use anyhow:: { anyhow, Context } ;
23use async_trait:: async_trait;
34use bytes:: Bytes ;
@@ -240,9 +241,9 @@ impl User {
240241 . await
241242 }
242243
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 > {
244245 log:: trace!( "Getting team membership for {:?}" , self . login) ;
245- let permission = crate :: team_data :: teams ( client ) . await ?;
246+ let permission = client . teams ( ) . await ?;
246247 let map = permission. teams ;
247248 let is_triager = map
248249 . get ( "wg-triage" )
@@ -262,49 +263,6 @@ impl User {
262263 }
263264}
264265
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-
308266#[ derive( PartialEq , Eq , Debug , Clone , serde:: Deserialize ) ]
309267pub struct Label {
310268 pub name : String ,
@@ -2055,10 +2013,11 @@ impl<'q> IssuesQuery for Query<'q> {
20552013 repo : & ' a Repository ,
20562014 include_fcp_details : bool ,
20572015 include_mcp_details : bool ,
2058- client : & ' a GithubClient ,
2016+ gh_client : & ' a GithubClient ,
2017+ team_client : & ' a TeamClient ,
20592018 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
20602019 let issues = repo
2061- . get_issues ( & client , self )
2020+ . get_issues ( & gh_client , self )
20622021 . await
20632022 . with_context ( || "Unable to get issues." ) ?;
20642023
@@ -2071,7 +2030,7 @@ impl<'q> IssuesQuery for Query<'q> {
20712030 } ;
20722031
20732032 let zulip_map = if include_fcp_details {
2074- Some ( crate :: team_data :: zulip_map ( client ) . await ?)
2033+ Some ( team_client . zulip_map ( ) . await ?)
20752034 } else {
20762035 None
20772036 } ;
@@ -2101,7 +2060,7 @@ impl<'q> IssuesQuery for Query<'q> {
21012060 let fk_initiating_comment = fcp. fcp . fk_initiating_comment ;
21022061 let ( initiating_comment_html_url, initiating_comment_content) = {
21032062 let comment = issue
2104- . get_comment ( & client , fk_initiating_comment)
2063+ . get_comment ( gh_client , fk_initiating_comment)
21052064 . await
21062065 . with_context ( || {
21072066 format ! (
@@ -2166,7 +2125,7 @@ impl<'q> IssuesQuery for Query<'q> {
21662125 } ;
21672126
21682127 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 ?;
21702129 let ( zulip_link, concerns) = if !first100_comments. is_empty ( ) {
21712130 let split = re_zulip_link
21722131 . split ( & first100_comments[ 0 ] . body )
@@ -2881,7 +2840,8 @@ pub trait IssuesQuery {
28812840 repo : & ' a Repository ,
28822841 include_fcp_details : bool ,
28832842 include_mcp_details : bool ,
2884- client : & ' a GithubClient ,
2843+ gh_client : & ' a GithubClient ,
2844+ team_client : & ' a TeamClient ,
28852845 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > ;
28862846}
28872847
@@ -2894,6 +2854,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
28942854 _include_fcp_details : bool ,
28952855 _include_mcp_details : bool ,
28962856 client : & ' a GithubClient ,
2857+ _team_client : & ' a TeamClient ,
28972858 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
28982859 use cynic:: QueryBuilder ;
28992860 use github_graphql:: queries;
@@ -3112,6 +3073,7 @@ impl IssuesQuery for DesignMeetings {
31123073 _include_fcp_details : bool ,
31133074 _include_mcp_details : bool ,
31143075 client : & ' a GithubClient ,
3076+ _team_client : & ' a TeamClient ,
31153077 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
31163078 use github_graphql:: project_items:: ProjectV2ItemContent ;
31173079
0 commit comments