File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ nlp.plugin(plugin);
133
133
134
134
function findWho ( message , action ) {
135
135
function findWhoSafe ( match ) {
136
- message = message . replace ( "-" , "#/#" ) ; // workaround (https://github.com/spencermountain/compromise/issues/726)
136
+ message = message . replace ( / \- / g , "#/#" ) ; // workaround (https://github.com/spencermountain/compromise/issues/726)
137
137
const whoNormalizeSettings = {
138
138
whitespace : true , // remove hyphens, newlines, and force one space between words
139
139
case : false , // keep only first-word, and 'entity' titlecasing
@@ -155,7 +155,7 @@ function findWho(message, action) {
155
155
156
156
if ( matchedSet . length > 0 ) {
157
157
matchedText = matchedSet [ 0 ] . text ;
158
- matchedText = matchedText . replace ( "#/#" , "-" ) ;
158
+ matchedText = matchedText . replace ( / # \/ # / g , "-" ) ;
159
159
160
160
return matchedText ;
161
161
}
Original file line number Diff line number Diff line change @@ -62,6 +62,17 @@ describe('parseComment', () => {
62
62
} )
63
63
} )
64
64
65
+ test ( 'Basic intent to add - username with multiple dashes' , ( ) => {
66
+ expect (
67
+ parseComment ( `@${ testBotName } please add rishi-raj-jain for doc` ) ,
68
+ ) . toEqual ( {
69
+ action : 'add' ,
70
+ contributors : {
71
+ "rishi-raj-jain" : [ 'doc' ] ,
72
+ } ,
73
+ } )
74
+ } )
75
+
65
76
test ( 'Basic intent to add - with plurals' , ( ) => {
66
77
expect (
67
78
parseComment ( `@${ testBotName } please add dat2 for docs` ) ,
You can’t perform that action at this time.
0 commit comments