File tree Expand file tree Collapse file tree 2 files changed +27
-18
lines changed Expand file tree Collapse file tree 2 files changed +27
-18
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use crate::{
88 github:: { Event , Label } ,
99 handlers:: Context ,
1010 interactions:: EditIssueBody ,
11+ utils:: is_issue_under_rfcbot_fcp,
1112} ;
1213use parser:: command:: concern:: ConcernCommand ;
1314
@@ -45,24 +46,11 @@ pub(super) async fn handle_command(
4546 } ;
4647 let issue = & issue_comment. issue ;
4748
48- // Verify that this issue isn't a rfcbot FCP, skip if it is
49- match crate :: rfcbot:: get_all_fcps ( ) . await {
50- Ok ( fcps) => {
51- if fcps. iter ( ) . any ( |( _, fcp) | {
52- u64:: from ( fcp. issue . number ) == issue. number
53- && fcp. issue . repository == issue_comment. repository . full_name
54- } ) {
55- tracing:: info!(
56- "{}#{} tried to register a concern, blocked by our rfcbot FCP check" ,
57- issue_comment. repository. full_name,
58- issue. number,
59- ) ;
60- return Ok ( ( ) ) ;
61- }
62- }
63- Err ( err) => {
64- tracing:: warn!( "unable to fetch rfcbot active FCPs: {err:?}, skipping check" ) ;
65- }
49+ // Verify that this issue isn't a rfcbot FCP
50+ if is_issue_under_rfcbot_fcp ( & issue_comment. repository . full_name , issue. number ) . await {
51+ return user_error ! (
52+ "Cannot set `@rustbot concern` on an active [rfcbot](https://rfcbot.rs/) FCP, use `@rfcbot concern` instead."
53+ ) ;
6654 }
6755
6856 // Verify that the comment author is a team member in our team repo
Original file line number Diff line number Diff line change @@ -35,3 +35,24 @@ pub(crate) async fn is_repo_autorized(
3535
3636 Ok ( true )
3737}
38+
39+ pub ( crate ) async fn is_issue_under_rfcbot_fcp (
40+ issue_full_repo_name : & str ,
41+ issue_number : u64 ,
42+ ) -> bool {
43+ match crate :: rfcbot:: get_all_fcps ( ) . await {
44+ Ok ( fcps) => {
45+ if fcps. iter ( ) . any ( |( _, fcp) | {
46+ u64:: from ( fcp. issue . number ) == issue_number
47+ && fcp. issue . repository == issue_full_repo_name
48+ } ) {
49+ return true ;
50+ }
51+ }
52+ Err ( err) => {
53+ tracing:: warn!( "unable to fetch rfcbot active FCPs: {err:?}, skipping check" ) ;
54+ }
55+ }
56+
57+ false
58+ }
You can’t perform that action at this time.
0 commit comments