File tree 2 files changed +32
-1
lines changed 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use crate::{
6
6
config:: ShortcutConfig ,
7
7
github:: { Event , Label } ,
8
8
handlers:: Context ,
9
- interactions:: ErrorComment ,
9
+ interactions:: { ErrorComment , PingComment } ,
10
10
} ;
11
11
use parser:: command:: shortcut:: ShortcutCommand ;
12
12
@@ -37,6 +37,14 @@ pub(super) async fn handle_command(
37
37
return Ok ( ( ) ) ;
38
38
}
39
39
issue. set_labels ( & ctx. github , issue_labels) . await ?;
40
+
41
+ let to_ping: Vec < _ > = issue
42
+ . assignees
43
+ . iter ( )
44
+ . map ( |user| user. login . as_str ( ) )
45
+ . collect ( ) ;
46
+ let cmnt = PingComment :: new ( & issue, & to_ping) ;
47
+ cmnt. post ( & ctx. github ) . await ?;
40
48
}
41
49
ShortcutCommand :: Author => {
42
50
if assign_and_remove_label ( & mut issue_labels, waiting_on_author, waiting_on_review)
@@ -45,6 +53,10 @@ pub(super) async fn handle_command(
45
53
return Ok ( ( ) ) ;
46
54
}
47
55
issue. set_labels ( & ctx. github , issue_labels) . await ?;
56
+
57
+ let to_ping = vec ! [ issue. user. login. as_str( ) ] ;
58
+ let cmnt = PingComment :: new ( & issue, & to_ping) ;
59
+ cmnt. post ( & ctx. github ) . await ?;
48
60
}
49
61
}
50
62
Original file line number Diff line number Diff line change @@ -29,6 +29,25 @@ impl<'a> ErrorComment<'a> {
29
29
}
30
30
}
31
31
32
+ pub struct PingComment < ' a > {
33
+ issue : & ' a Issue ,
34
+ users : & ' a [ & ' a str ] ,
35
+ }
36
+
37
+ impl < ' a > PingComment < ' a > {
38
+ pub fn new ( issue : & ' a Issue , users : & ' a [ & str ] ) -> PingComment < ' a > {
39
+ PingComment { issue, users }
40
+ }
41
+
42
+ pub async fn post ( & self , client : & GithubClient ) -> anyhow:: Result < ( ) > {
43
+ let mut body = String :: new ( ) ;
44
+ for user in self . users {
45
+ write ! ( body, "@{} " , user) ?;
46
+ }
47
+ self . issue . post_comment ( client, & body) . await
48
+ }
49
+ }
50
+
32
51
pub struct EditIssueBody < ' a > {
33
52
issue : & ' a Issue ,
34
53
id : & ' static str ,
You can’t perform that action at this time.
0 commit comments