Skip to content

Commit a06f6e0

Browse files
Merge 3926497 into 016ba93
2 parents 016ba93 + 3926497 commit a06f6e0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/parse-comment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ nlp.plugin(plugin);
134134

135135
function findWho(message, action) {
136136
function findWhoSafe(match) {
137-
message = message.replace("-", "#/#"); // workaround (https://github.com/spencermountain/compromise/issues/726)
137+
message = message.replace(/\-/g, "#/#"); // workaround (https://github.com/spencermountain/compromise/issues/726)
138138
const whoNormalizeSettings = {
139139
whitespace: true, // remove hyphens, newlines, and force one space between words
140140
case: false, // keep only first-word, and 'entity' titlecasing
@@ -156,7 +156,7 @@ function findWho(message, action) {
156156

157157
if (matchedSet.length > 0) {
158158
matchedText = matchedSet[0].text;
159-
matchedText = matchedText.replace("#/#", "-");
159+
matchedText = matchedText.replace(/#\/#/g, "-");
160160

161161
return matchedText;
162162
}

test/unit/parse-comment.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ describe('parseComment', () => {
6262
})
6363
})
6464

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+
6576
test('Basic intent to add - with plurals', () => {
6677
expect(
6778
parseComment(`@${testBotName} please add dat2 for docs`),

0 commit comments

Comments
 (0)