File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ const plugin = {
57
57
nlp . plugin ( plugin )
58
58
59
59
function parseAddComment ( doc , action ) {
60
- const who = doc
60
+ const whoMatched = doc
61
61
. match ( `${ action } [.]` )
62
62
. normalize ( {
63
63
whitespace : true , // remove hyphens, newlines, and force one space between words
@@ -75,6 +75,8 @@ function parseAddComment(doc, action) {
75
75
} )
76
76
. data ( ) [ 0 ] . text
77
77
78
+ const who = whoMatched . startsWith ( '@' ) ? whoMatched . substr ( 1 ) : whoMatched
79
+
78
80
// TODO: handle plurals (e.g. some said docs)
79
81
let contributions = doc
80
82
. match ( '#Contribution' )
Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ describe('parseComment', () => {
55
55
} )
56
56
} )
57
57
58
+ test ( 'Support adding people with mentions' , ( ) => {
59
+ expect (
60
+ parseComment (
61
+ `@${ testBotName } please add @sinchang for infrastructure` ,
62
+ ) ,
63
+ ) . toEqual ( {
64
+ action : 'add' ,
65
+ who : 'sinchang' ,
66
+ contributions : [ 'infra' ] ,
67
+ } )
68
+ } )
69
+
58
70
// TODO: make it so this works
59
71
// test('Support split words (like user testing)', () => {
60
72
// expect(
You can’t perform that action at this time.
0 commit comments