@@ -9,6 +9,7 @@ const config = require('./config');
9
9
const notificationServer = require ( '../index' ) ;
10
10
const _ = require ( 'lodash' ) ;
11
11
const service = require ( './service' ) ;
12
+ const { BUS_API_EVENT } = require ( '../src/constants' )
12
13
const EVENTS = require ( './events-config' ) . EVENTS ;
13
14
const TOPCODER_ROLE_RULES = require ( './events-config' ) . TOPCODER_ROLE_RULES ;
14
15
const PROJECT_ROLE_RULES = require ( './events-config' ) . PROJECT_ROLE_RULES ;
@@ -67,14 +68,14 @@ const getNotificationsForMentionedUser = (eventConfig, content) => {
67
68
68
69
let notifications = [ ] ;
69
70
// eslint-disable-next-line
70
- const regexUserHandle = / t i t l e = \" @ ( [ a - z A - Z 0 - 9 - _ .{ } \[ \] ] + ) \" / g;
71
+ const regexUserHandle = / t i t l e = \" @ ( [ a - z A - Z 0 - 9 - _ .{ } \[ \] ] + ) \" | \[ ( . * ) \] \( . * \" \@ ( . * ) \" \) / g;
71
72
const handles = [ ] ;
72
73
let matches = regexUserHandle . exec ( content ) ;
73
74
while ( matches ) {
74
75
const handle = matches [ 1 ] . toString ( ) ;
75
76
notifications . push ( {
76
77
userHandle : handle ,
77
- newType : 'notifications.connect.project.post.mention' ,
78
+ newType : BUS_API_EVENT . EMAIL . MENTIONED_IN_POST ,
78
79
contents : {
79
80
toUserHandle : true ,
80
81
} ,
@@ -279,7 +280,7 @@ const handler = (topic, message, callback) => {
279
280
280
281
// filter out `notifications.connect.project.topic.created` events send by bot
281
282
// because they create too much clutter and duplicate info
282
- if ( topic === 'notifications.connect.project.topic.created' && message . userId . toString ( ) === config . TCWEBSERVICE_ID ) {
283
+ if ( topic === BUS_API_EVENT . CONNECT . TOPIC_CREATED && message . userId . toString ( ) === config . TCWEBSERVICE_ID ) {
283
284
return callback ( null , [ ] ) ;
284
285
}
285
286
0 commit comments