Skip to content

Commit 06ff1e1

Browse files
author
Vikas Agarwal
committed
Fixed accessing wrong match group
1 parent f016b66 commit 06ff1e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

connect/connectNotificationServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ const getNotificationsForMentionedUser = (eventConfig, content) => {
6868

6969
let notifications = [];
7070
// eslint-disable-next-line
71-
const regexUserHandle = /title=\"@([a-zA-Z0-9-_.{}\[\]]+)\"|\[(.*)\]\(.*\"\@(.*)\"\)/g;
71+
const regexUserHandle = /title=\"@([a-zA-Z0-9-_.{}\[\]]+)\"|\[.*\]\(.*\"\@(.*)\"\)/g;
7272
const handles = [];
7373
let matches = regexUserHandle.exec(content);
7474
while (matches) {
75-
const handle = matches[1].toString();
75+
const handle = matches[1] ? matches[1].toString() : matches[2].toString();
7676
notifications.push({
7777
userHandle: handle,
7878
newType: BUS_API_EVENT.CONNECT.MENTIONED_IN_POST,

0 commit comments

Comments
 (0)