@@ -58,33 +58,31 @@ async fn handle_input(ctx: &Context, config: &PrioritizeConfig, event: &Event) -
58
58
} ;
59
59
60
60
let issue = event. issue ( ) . unwrap ( ) ;
61
- if !is_team_member {
62
- let cmnt = ErrorComment :: new ( & issue, "Only Rust team members can prioritize issues." ) ;
63
- cmnt. post ( & ctx. github ) . await ?;
64
- return Ok ( ( ) ) ;
65
- }
66
61
67
- if issue. labels ( ) . iter ( ) . any ( |l| l. name == "I-prioritize" ) {
68
- let cmnt = ErrorComment :: new ( & issue, "This issue is already prioritized! " ) ;
62
+ if issue. labels ( ) . iter ( ) . any ( |l| l. name == config . label ) {
63
+ let cmnt = ErrorComment :: new ( & issue, "This issue has already been requested for prioritization. " ) ;
69
64
cmnt. post ( & ctx. github ) . await ?;
70
65
return Ok ( ( ) ) ;
71
66
}
72
67
73
68
let mut labels = issue. labels ( ) . to_owned ( ) ;
74
69
labels. push ( github:: Label {
75
- name : "I-prioritize" . to_string ( ) ,
70
+ name : config . label . clone ( ) ,
76
71
} ) ;
77
72
let github_req = issue. set_labels ( & ctx. github , labels) ;
78
73
79
- let mut zulip_topic = format ! ( "I-pri #{} {}" , issue. number, issue. title) ;
74
+ let mut zulip_topic = format ! ( "{} #{} {}" , config . label , issue. number, issue. title) ;
80
75
zulip_topic. truncate ( 60 ) ; // Zulip limitation
81
- let client = reqwest :: Client :: new ( ) ; // TODO: have a Zulip Client akin to GithubClient
82
- let zulip_req = client . post ( "https://rust-lang.zulipchat.com/api/v1/messages" )
76
+
77
+ let zulip_req = ctx . github . raw ( ) . post ( "https://rust-lang.zulipchat.com/api/v1/messages" )
83
78
. form ( & [
84
79
( "type" , "stream" ) ,
85
- ( "to" , config. zulip_stream . to_string ( ) . as_str ( ) ) ,
80
+ ( "to" , & config. zulip_stream . to_string ( ) ) ,
86
81
( "topic" , & zulip_topic) ,
87
- ( "content" , "@*WG-prioritization*" ) ,
82
+ ( "content" , & format ! (
83
+ "@*WG-prioritization* issue [#{}]({}) has been requested for prioritization." ,
84
+ issue. number, event. html_url( ) . unwrap( )
85
+ ) ) ,
88
86
] )
89
87
. send ( ) ;
90
88
0 commit comments