@@ -14,7 +14,7 @@ use domain::rfcbot::{FcpConcern, FcpProposal, FcpReviewRequest, FeedbackRequest,
14
14
use domain:: schema:: * ;
15
15
use error:: * ;
16
16
use github:: models:: CommentFromJson ;
17
- use teams:: TEAMS ;
17
+ use teams:: SETUP ;
18
18
use super :: GH ;
19
19
20
20
#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
@@ -464,24 +464,31 @@ fn evaluate_nags() -> DashResult<()> {
464
464
Ok ( ( ) )
465
465
}
466
466
467
- fn execute_ffcp_actions ( issue : & Issue , disposition : FcpDisposition ) {
468
- if !is_rfc_repo ( & issue) { return ; }
467
+ fn can_ffcp_close ( issue : & Issue ) -> bool {
468
+ SETUP . should_ffcp_auto_close ( & issue. repository )
469
+ }
470
+
471
+ fn can_ffcp_postpone ( issue : & Issue ) -> bool {
472
+ SETUP . should_ffcp_auto_postpone ( & issue. repository )
473
+ }
469
474
475
+ fn execute_ffcp_actions ( issue : & Issue , disposition : FcpDisposition ) {
470
476
match disposition {
471
477
FcpDisposition :: Merge => {
472
478
// TODO: This one will require a lot of work to
473
479
// auto-merge RFCs and create the tracking issue.
474
480
} ,
475
- FcpDisposition :: Close => {
481
+ FcpDisposition :: Close if can_ffcp_close ( issue ) => {
476
482
let _ = issue. add_label ( Label :: Closed ) ;
477
483
issue. remove_label ( Label :: DispositionClose ) ;
478
484
issue. close ( ) ;
479
485
} ,
480
- FcpDisposition :: Postpone => {
486
+ FcpDisposition :: Postpone if can_ffcp_postpone ( issue ) => {
481
487
let _ = issue. add_label ( Label :: Postponed ) ;
482
488
issue. remove_label ( Label :: DispositionPostpone ) ;
483
489
issue. close ( ) ;
484
490
} ,
491
+ _ => { } ,
485
492
}
486
493
}
487
494
@@ -566,9 +573,9 @@ fn subteam_members(issue: &Issue) -> DashResult<Vec<GitHubUser>> {
566
573
567
574
// retrieve all of the teams tagged on this issue
568
575
// cannot WAIT for by-ref/by-val inference
569
- let member_logins = TEAMS . iter ( )
576
+ let member_logins = SETUP . teams ( )
570
577
. filter ( |& ( ref label, _) | issue. labels . contains ( & label. 0 ) )
571
- . flat_map ( |( _, team) | & team. member_logins )
578
+ . flat_map ( |( _, team) | team. member_logins ( ) )
572
579
. collect :: < BTreeSet < _ > > ( )
573
580
. into_iter ( ) // diesel won't work with btreeset, and dedup has weird lifetime errors
574
581
. collect :: < Vec < _ > > ( ) ;
@@ -1028,10 +1035,6 @@ enum CommentType<'a> {
1028
1035
} ,
1029
1036
}
1030
1037
1031
- fn is_rfc_repo ( issue : & Issue ) -> bool {
1032
- issue. repository == "rust-lang/rfcs"
1033
- }
1034
-
1035
1038
impl < ' a > RfcBotComment < ' a > {
1036
1039
fn new ( issue : & ' a Issue , comment_type : CommentType < ' a > ) -> RfcBotComment < ' a > {
1037
1040
@@ -1146,16 +1149,15 @@ impl<'a> RfcBotComment<'a> {
1146
1149
Self :: add_comment_url ( issue, & mut msg, status_comment_id) ;
1147
1150
msg. push_str ( "), is now **complete**." ) ;
1148
1151
1149
- if is_rfc_repo ( issue) {
1150
- match disposition {
1151
- FcpDisposition :: Merge => { }
1152
- FcpDisposition :: Close => {
1153
- msg. push_str ( "\n \n By the power vested in me by Rust, I hereby close this RFC." ) ;
1154
- } ,
1155
- FcpDisposition :: Postpone => {
1156
- msg. push_str ( "\n \n By the power vested in me by Rust, I hereby postpone this RFC." ) ;
1157
- } ,
1158
- }
1152
+ match disposition {
1153
+ FcpDisposition :: Merge => { }
1154
+ FcpDisposition :: Close if can_ffcp_close ( issue) => {
1155
+ msg. push_str ( "\n \n By the power vested in me by Rust, I hereby close this RFC." ) ;
1156
+ } ,
1157
+ FcpDisposition :: Postpone if can_ffcp_postpone ( issue) => {
1158
+ msg. push_str ( "\n \n By the power vested in me by Rust, I hereby postpone this RFC." ) ;
1159
+ } ,
1160
+ _ => { } ,
1159
1161
}
1160
1162
1161
1163
if !added_label {
0 commit comments