@@ -480,6 +480,18 @@ impl Issue {
480
480
Ok ( comment)
481
481
}
482
482
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
+
483
495
pub async fn edit_body ( & self , client : & GithubClient , body : & str ) -> anyhow:: Result < ( ) > {
484
496
let edit_url = format ! ( "{}/issues/{}" , self . repository( ) . url( ) , self . number) ;
485
497
#[ derive( serde:: Serialize ) ]
@@ -1574,6 +1586,7 @@ impl<'q> IssuesQuery for Query<'q> {
1574
1586
& ' a self ,
1575
1587
repo : & ' a Repository ,
1576
1588
include_fcp_details : bool ,
1589
+ include_mcp_details : bool ,
1577
1590
client : & ' a GithubClient ,
1578
1591
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
1579
1592
let issues = repo
@@ -1588,12 +1601,13 @@ impl<'q> IssuesQuery for Query<'q> {
1588
1601
} ;
1589
1602
1590
1603
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 ( ) ;
1591
1606
for issue in issues {
1592
1607
let fcp_details = if include_fcp_details {
1593
1608
let repository_name = if let Some ( repo) = issue. repository . get ( ) {
1594
1609
repo. repository . clone ( )
1595
1610
} else {
1596
- let re = regex:: Regex :: new ( "https://github.com/rust-lang/|/" ) . unwrap ( ) ;
1597
1611
let split = re. split ( & issue. html_url ) . collect :: < Vec < & str > > ( ) ;
1598
1612
split[ 1 ] . to_string ( )
1599
1613
} ;
@@ -1626,6 +1640,18 @@ impl<'q> IssuesQuery for Query<'q> {
1626
1640
} else {
1627
1641
None
1628
1642
} ;
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
+
1629
1655
issues_decorator. push ( crate :: actions:: IssueDecorator {
1630
1656
title : issue. title . clone ( ) ,
1631
1657
number : issue. number ,
@@ -1645,6 +1671,7 @@ impl<'q> IssuesQuery for Query<'q> {
1645
1671
. join ( ", " ) ,
1646
1672
updated_at_hts : crate :: actions:: to_human ( issue. updated_at ) ,
1647
1673
fcp_details,
1674
+ mcp_details,
1648
1675
} ) ;
1649
1676
}
1650
1677
@@ -2112,6 +2139,7 @@ pub trait IssuesQuery {
2112
2139
& ' a self ,
2113
2140
repo : & ' a Repository ,
2114
2141
include_fcp_details : bool ,
2142
+ include_mcp_details : bool ,
2115
2143
client : & ' a GithubClient ,
2116
2144
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > ;
2117
2145
}
@@ -2123,6 +2151,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
2123
2151
& ' a self ,
2124
2152
repo : & ' a Repository ,
2125
2153
_include_fcp_details : bool ,
2154
+ _include_mcp_details : bool ,
2126
2155
client : & ' a GithubClient ,
2127
2156
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
2128
2157
use cynic:: QueryBuilder ;
@@ -2249,6 +2278,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
2249
2278
assignees,
2250
2279
updated_at_hts,
2251
2280
fcp_details : None ,
2281
+ mcp_details : None ,
2252
2282
}
2253
2283
} ,
2254
2284
)
@@ -2336,6 +2366,7 @@ impl IssuesQuery for DesignMeetings {
2336
2366
& ' a self ,
2337
2367
_repo : & ' a Repository ,
2338
2368
_include_fcp_details : bool ,
2369
+ _include_mcp_details : bool ,
2339
2370
client : & ' a GithubClient ,
2340
2371
) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
2341
2372
use github_graphql:: project_items:: ProjectV2ItemContent ;
@@ -2350,6 +2381,7 @@ impl IssuesQuery for DesignMeetings {
2350
2381
assignees : String :: new ( ) ,
2351
2382
number : issue. number . try_into ( ) . unwrap ( ) ,
2352
2383
fcp_details : None ,
2384
+ mcp_details : None ,
2353
2385
html_url : issue. url . 0 ,
2354
2386
title : issue. title ,
2355
2387
repo_name : String :: new ( ) ,
0 commit comments