@@ -480,6 +480,18 @@ impl Issue {
480480 Ok ( comment)
481481 }
482482
483+ // returns an array of one element
484+ pub async fn get_first_comment ( & self , client : & GithubClient ) -> anyhow:: Result < Vec < Comment > > {
485+ let comment_url = format ! (
486+ "{}/issues/{}/comments?page=1&per_page=1" ,
487+ self . repository( ) . url( ) ,
488+ self . number,
489+ ) ;
490+ Ok ( client
491+ . json :: < Vec < Comment > > ( client. get ( & comment_url) )
492+ . await ?)
493+ }
494+
483495 pub async fn edit_body ( & self , client : & GithubClient , body : & str ) -> anyhow:: Result < ( ) > {
484496 let edit_url = format ! ( "{}/issues/{}" , self . repository( ) . url( ) , self . number) ;
485497 #[ derive( serde:: Serialize ) ]
@@ -1574,6 +1586,7 @@ impl<'q> IssuesQuery for Query<'q> {
15741586 & ' a self ,
15751587 repo : & ' a Repository ,
15761588 include_fcp_details : bool ,
1589+ include_mcp_details : bool ,
15771590 client : & ' a GithubClient ,
15781591 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
15791592 let issues = repo
@@ -1588,12 +1601,13 @@ impl<'q> IssuesQuery for Query<'q> {
15881601 } ;
15891602
15901603 let mut issues_decorator = Vec :: new ( ) ;
1604+ let re = regex:: Regex :: new ( "https://github.com/rust-lang/|/" ) . unwrap ( ) ;
1605+ let re_zulip_link = regex:: Regex :: new ( r"\[stream\]:\s" ) . unwrap ( ) ;
15911606 for issue in issues {
15921607 let fcp_details = if include_fcp_details {
15931608 let repository_name = if let Some ( repo) = issue. repository . get ( ) {
15941609 repo. repository . clone ( )
15951610 } else {
1596- let re = regex:: Regex :: new ( "https://github.com/rust-lang/|/" ) . unwrap ( ) ;
15971611 let split = re. split ( & issue. html_url ) . collect :: < Vec < & str > > ( ) ;
15981612 split[ 1 ] . to_string ( )
15991613 } ;
@@ -1626,6 +1640,18 @@ impl<'q> IssuesQuery for Query<'q> {
16261640 } else {
16271641 None
16281642 } ;
1643+
1644+ let mcp_details = if include_mcp_details {
1645+ let first_comment = issue. get_first_comment ( & client) . await ?;
1646+ let split = re_zulip_link
1647+ . split ( & first_comment[ 0 ] . body )
1648+ . collect :: < Vec < & str > > ( ) ;
1649+ let zulip_link = split. last ( ) . unwrap_or ( & "#" ) . to_string ( ) ;
1650+ Some ( crate :: actions:: MCPDetails { zulip_link } )
1651+ } else {
1652+ None
1653+ } ;
1654+
16291655 issues_decorator. push ( crate :: actions:: IssueDecorator {
16301656 title : issue. title . clone ( ) ,
16311657 number : issue. number ,
@@ -1645,6 +1671,7 @@ impl<'q> IssuesQuery for Query<'q> {
16451671 . join ( ", " ) ,
16461672 updated_at_hts : crate :: actions:: to_human ( issue. updated_at ) ,
16471673 fcp_details,
1674+ mcp_details,
16481675 } ) ;
16491676 }
16501677
@@ -2112,6 +2139,7 @@ pub trait IssuesQuery {
21122139 & ' a self ,
21132140 repo : & ' a Repository ,
21142141 include_fcp_details : bool ,
2142+ include_mcp_details : bool ,
21152143 client : & ' a GithubClient ,
21162144 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > ;
21172145}
@@ -2123,6 +2151,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
21232151 & ' a self ,
21242152 repo : & ' a Repository ,
21252153 _include_fcp_details : bool ,
2154+ _include_mcp_details : bool ,
21262155 client : & ' a GithubClient ,
21272156 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
21282157 use cynic:: QueryBuilder ;
@@ -2249,6 +2278,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
22492278 assignees,
22502279 updated_at_hts,
22512280 fcp_details : None ,
2281+ mcp_details : None ,
22522282 }
22532283 } ,
22542284 )
@@ -2336,6 +2366,7 @@ impl IssuesQuery for DesignMeetings {
23362366 & ' a self ,
23372367 _repo : & ' a Repository ,
23382368 _include_fcp_details : bool ,
2369+ _include_mcp_details : bool ,
23392370 client : & ' a GithubClient ,
23402371 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
23412372 use github_graphql:: project_items:: ProjectV2ItemContent ;
@@ -2350,6 +2381,7 @@ impl IssuesQuery for DesignMeetings {
23502381 assignees : String :: new ( ) ,
23512382 number : issue. number . try_into ( ) . unwrap ( ) ,
23522383 fcp_details : None ,
2384+ mcp_details : None ,
23532385 html_url : issue. url . 0 ,
23542386 title : issue. title ,
23552387 repo_name : String :: new ( ) ,
0 commit comments