@@ -9,6 +9,7 @@ const config = require('./config');
99const notificationServer = require ( '../index' ) ;
1010const _ = require ( 'lodash' ) ;
1111const service = require ( './service' ) ;
12+ const { BUS_API_EVENT } = require ( '../src/constants' )
1213const EVENTS = require ( './events-config' ) . EVENTS ;
1314const TOPCODER_ROLE_RULES = require ( './events-config' ) . TOPCODER_ROLE_RULES ;
1415const PROJECT_ROLE_RULES = require ( './events-config' ) . PROJECT_ROLE_RULES ;
@@ -67,14 +68,14 @@ const getNotificationsForMentionedUser = (eventConfig, content) => {
6768
6869 let notifications = [ ] ;
6970 // 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;
7172 const handles = [ ] ;
7273 let matches = regexUserHandle . exec ( content ) ;
7374 while ( matches ) {
7475 const handle = matches [ 1 ] . toString ( ) ;
7576 notifications . push ( {
7677 userHandle : handle ,
77- newType : 'notifications.connect.project.post.mention' ,
78+ newType : BUS_API_EVENT . EMAIL . MENTIONED_IN_POST ,
7879 contents : {
7980 toUserHandle : true ,
8081 } ,
@@ -279,7 +280,7 @@ const handler = (topic, message, callback) => {
279280
280281 // filter out `notifications.connect.project.topic.created` events send by bot
281282 // 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 ) {
283284 return callback ( null , [ ] ) ;
284285 }
285286
0 commit comments