@tiledesk/tiledesk-server 2.3.35 → 2.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docker-community-worker-push-latest.yml +23 -0
- package/.github/workflows/docker-image-tag-worker-community-tag-push.yml +22 -0
- package/CHANGELOG.md +12 -3
- package/Dockerfile-jobs +31 -0
- package/app.js +12 -2
- package/channels/chat21/chat21Handler.js +19 -3
- package/jobs.js +80 -0
- package/jobsManager.js +47 -0
- package/models/faq.js +5 -1
- package/package.json +1 -1
- package/pubmodules/activities/activityArchiver.js +197 -90
- package/pubmodules/emailNotification/requestNotification.js +16 -15
- package/pubmodules/events/eventRoute.js +3 -0
- package/pubmodules/pubModulesManager.js +5 -5
- package/pubmodules/queue/reconnect.js +96 -12
- package/pubmodules/queue/reconnectFanout.js +18 -12
- package/pubmodules/trigger/rulesTrigger.js +7 -1
- package/routes/faq.js +5 -1
- package/routes/faq_kb.js +131 -5
- package/routes/users-util.js +9 -1
- package/services/emailService.js +13 -3
- package/services/faqService.js +15 -0
- package/services/geoService.js +5 -5
- package/services/requestService.js +1 -0
- package/test/example-json.txt +1 -0
- package/test/faqRoute.js +47 -99
- package/test/faqkbRoute.js +204 -66
|
@@ -42,7 +42,13 @@ class ActivityArchiver {
|
|
|
42
42
|
activityEvent.on('lead.download.csv', this.save);
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
var authProjectUserInvitePendingKey = 'project_user.invite.pending'; //Don't work if job_worker enabled because queue.worker is disabled
|
|
46
|
+
// if (authEvent.queueEnabled) { //queue not supported.
|
|
47
|
+
// authProjectUserInvitePendingKey = 'project_user.invite.pending.queue';
|
|
48
|
+
// }
|
|
49
|
+
winston.info('ActivityArchiver authProjectUserInvitePendingKey: ' + authProjectUserInvitePendingKey);
|
|
50
|
+
|
|
51
|
+
authEvent.on(authProjectUserInvitePendingKey, function(event) {
|
|
46
52
|
setImmediate(() => {
|
|
47
53
|
if (event.skipArchive) {
|
|
48
54
|
return 0;
|
|
@@ -57,7 +63,13 @@ class ActivityArchiver {
|
|
|
57
63
|
|
|
58
64
|
});
|
|
59
65
|
|
|
60
|
-
|
|
66
|
+
var authProjectUserInviteKey = 'project_user.invite'; //Don't work if job_worker enabled because queue.worker is disabled
|
|
67
|
+
// if (authEvent.queueEnabled) { //queue not supported
|
|
68
|
+
// authProjectUserInviteKey = 'project_user.invite.queue';
|
|
69
|
+
// }
|
|
70
|
+
winston.info('ActivityArchiver authProjectUserInviteKey: ' + authProjectUserInviteKey);
|
|
71
|
+
|
|
72
|
+
authEvent.on(authProjectUserInviteKey, function(event) {
|
|
61
73
|
setImmediate(() => {
|
|
62
74
|
if (event.skipArchive) {
|
|
63
75
|
return 0;
|
|
@@ -73,9 +85,17 @@ class ActivityArchiver {
|
|
|
73
85
|
});
|
|
74
86
|
});
|
|
75
87
|
|
|
88
|
+
// verified with queue
|
|
89
|
+
var authProjectUserUpdateKey = 'project_user.update';
|
|
90
|
+
if (authEvent.queueEnabled) {
|
|
91
|
+
authProjectUserUpdateKey = 'project_user.update.queue';
|
|
92
|
+
}
|
|
93
|
+
winston.info('ActivityArchiver authProjectUserUpdateKey: ' + authProjectUserUpdateKey);
|
|
94
|
+
|
|
95
|
+
authEvent.on(authProjectUserUpdateKey, function(event) {
|
|
96
|
+
setImmediate(() => {
|
|
97
|
+
// winston.info('ActivityArchiver authProjectUserUpdateKey: ', event);
|
|
76
98
|
|
|
77
|
-
authEvent.on('project_user.update', function(event) {
|
|
78
|
-
setImmediate(() => {
|
|
79
99
|
/*
|
|
80
100
|
2019-11-20T10:40:52.686991+00:00 app[web.1]: TypeError: Cannot read property '_id' of undefined
|
|
81
101
|
*/
|
|
@@ -86,20 +106,34 @@ class ActivityArchiver {
|
|
|
86
106
|
var project_user = undefined;
|
|
87
107
|
if (event.updatedProject_userPopulated.toObject) {
|
|
88
108
|
project_user = event.updatedProject_userPopulated.toObject()
|
|
89
|
-
}else {
|
|
109
|
+
} else {
|
|
90
110
|
project_user = event.updatedProject_userPopulated;
|
|
91
111
|
}
|
|
92
|
-
|
|
112
|
+
|
|
113
|
+
winston.info('ActivityArchiver authProjectUserUpdateKey event: ', event);
|
|
114
|
+
|
|
115
|
+
if (!event.req.user) {
|
|
116
|
+
return winston.info('ActivityArchiver skipping archive empty user'); //from i think chat21webhook
|
|
117
|
+
}
|
|
118
|
+
var activity = new Activity({actor: {type:"user", id: event.req.user._id, name: event.req.user.fullName },
|
|
93
119
|
verb: "PROJECT_USER_UPDATE", actionObj: event.req.body,
|
|
94
120
|
target: {type:"project_user", id: event.updatedProject_userPopulated._id.toString(), object: project_user},
|
|
95
|
-
id_project: event.
|
|
121
|
+
id_project: event.updatedProject_userPopulated.id_project });
|
|
96
122
|
that.save(activity);
|
|
97
123
|
|
|
98
124
|
});
|
|
99
125
|
|
|
100
126
|
});
|
|
101
127
|
|
|
102
|
-
|
|
128
|
+
|
|
129
|
+
var authProjectUserDeleteKey = 'project_user.delete'; //Don't work if job_worker enabled because queue.worker is disabled
|
|
130
|
+
// if (authEvent.queueEnabled) { //queue not supported
|
|
131
|
+
// authProjectUserDeleteKey = 'project_user.delete.queue';
|
|
132
|
+
// }
|
|
133
|
+
winston.info('ActivityArchiver authProjectUserDeleteKey: ' + authProjectUserDeleteKey);
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
authEvent.on(authProjectUserDeleteKey, function(event) {
|
|
103
137
|
setImmediate(() => {
|
|
104
138
|
if (event.skipArchive) {
|
|
105
139
|
return 0;
|
|
@@ -115,105 +149,159 @@ class ActivityArchiver {
|
|
|
115
149
|
});
|
|
116
150
|
|
|
117
151
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (event.skipArchive) {
|
|
124
|
-
return 0;
|
|
125
|
-
}
|
|
152
|
+
// var authUserSignineKey = 'user.signin';
|
|
153
|
+
// // if (authEvent.queueEnabled) { //queue not supported
|
|
154
|
+
// // authUserSignineKey = 'user.signin.queue';
|
|
155
|
+
// // }
|
|
156
|
+
// winston.info('ActivityArchiver authUserSignineKey: ' + authUserSignineKey);
|
|
126
157
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
158
|
+
|
|
159
|
+
// authEvent.on(authUserSignineKey, function(event) {
|
|
160
|
+
// winston.info('ActivityArchiver user.login');
|
|
161
|
+
// setImmediate(() => {
|
|
162
|
+
|
|
132
163
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
164
|
+
// if (event.skipArchive) {
|
|
165
|
+
// return 0;
|
|
166
|
+
// }
|
|
167
|
+
|
|
168
|
+
// var activity = new Activity({actor: {type:"user", id: event.user._id, name: event.user.fullName },
|
|
169
|
+
// verb: "USER_SIGNIN", actionObj: event.req.body, //insecure it store password
|
|
170
|
+
// target: {type:"user", id:event.user._id.toString(), object: null },
|
|
171
|
+
// id_project: '*' }); /// * project
|
|
172
|
+
// that.save(activity);
|
|
137
173
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
174
|
+
// });
|
|
175
|
+
// });
|
|
141
176
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
177
|
+
|
|
178
|
+
// var authUserSigninErrorKey = 'user.login.error';
|
|
179
|
+
// // if (authEvent.queueEnabled) { //queue not supported
|
|
180
|
+
// // authUserSigninErrorKey = 'user.login.error.queue';
|
|
181
|
+
// // }
|
|
182
|
+
// winston.info('ActivityArchiver authUserSigninErrorKey: ' + authUserSigninErrorKey);
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
// authEvent.on(authUserSigninErrorKey, function(event) {
|
|
186
|
+
// setImmediate(() => {
|
|
147
187
|
|
|
148
|
-
|
|
149
|
-
|
|
188
|
+
// if (event.skipArchive) {
|
|
189
|
+
// return 0;
|
|
190
|
+
// }
|
|
191
|
+
|
|
192
|
+
// var activity = new Activity({actor: {type:"user"},
|
|
193
|
+
// verb: "USER_SIGNIN_ERROR", actionObj: event.req.body, //insecure it store password
|
|
194
|
+
// target: {type:"user", id:null, object: null },
|
|
195
|
+
// id_project: '*' }); /// * project
|
|
196
|
+
// that.save(activity);
|
|
197
|
+
|
|
198
|
+
// });
|
|
199
|
+
// });
|
|
150
200
|
|
|
151
|
-
authEvent.on('user.requestresetpassword', function(event) {
|
|
152
|
-
setImmediate(() => {
|
|
153
|
-
|
|
154
|
-
if (event.skipArchive) {
|
|
155
|
-
return 0;
|
|
156
|
-
}
|
|
157
201
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
202
|
+
// var authUserResetPasswordKey = 'user.requestresetpassword';
|
|
203
|
+
// // if (authEvent.queueEnabled) { //queue not supported
|
|
204
|
+
// // authUserResetPasswordKey = 'user.requestresetpassword.queue';
|
|
205
|
+
// // }
|
|
206
|
+
// winston.info('ActivityArchiver authUserResetPasswordKey: ' + authUserResetPasswordKey);
|
|
207
|
+
|
|
208
|
+
// authEvent.on(authUserResetPasswordKey, function(event) {
|
|
209
|
+
// setImmediate(() => {
|
|
210
|
+
|
|
211
|
+
// if (event.skipArchive) {
|
|
212
|
+
// return 0;
|
|
213
|
+
// }
|
|
214
|
+
|
|
215
|
+
// var activity = new Activity({actor: {type:"user", id: event.updatedUser._id, name: event.updatedUser.fullName },
|
|
216
|
+
// verb: "USER_REQUEST_RESETPASSWORD", actionObj: event.req.body,
|
|
217
|
+
// target: {type:"user", id:event.updatedUser._id.toString(), object: null },
|
|
218
|
+
// id_project: '*' }); /// * project
|
|
219
|
+
// that.save(activity);
|
|
163
220
|
|
|
164
|
-
|
|
165
|
-
|
|
221
|
+
// });
|
|
222
|
+
// });
|
|
166
223
|
|
|
167
|
-
authEvent.on('user.resetpassword', function(event) {
|
|
168
|
-
setImmediate(() => {
|
|
169
|
-
|
|
170
|
-
if (event.skipArchive) {
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
173
224
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
225
|
+
// var authUserResetPassword2Key = 'user.resetpassword';
|
|
226
|
+
// // if (authEvent.queueEnabled) { //queue not supported
|
|
227
|
+
// // authUserResetPassword2Key = 'user.resetpassword.queue';
|
|
228
|
+
// // }
|
|
229
|
+
// winston.info('ActivityArchiver authUserResetPassword2Key: ' + authUserResetPassword2Key);
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
// authEvent.on(authUserResetPassword2Key, function(event) {
|
|
233
|
+
// setImmediate(() => {
|
|
234
|
+
|
|
235
|
+
// if (event.skipArchive) {
|
|
236
|
+
// return 0;
|
|
237
|
+
// }
|
|
238
|
+
|
|
239
|
+
// var activity = new Activity({actor: {type:"user", id: event.saveUser._id, name: event.saveUser.fullName },
|
|
240
|
+
// verb: "USER_RESETPASSWORD", actionObj: null, //req.body otherwise print password
|
|
241
|
+
// target: {type:"user", id:event.saveUser._id.toString(), object: null },
|
|
242
|
+
// id_project: '*' }); /// * project
|
|
243
|
+
// that.save(activity);
|
|
179
244
|
|
|
180
|
-
|
|
181
|
-
});
|
|
245
|
+
// });
|
|
246
|
+
// });
|
|
182
247
|
|
|
183
248
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
249
|
+
// var authUserSignupKey = 'user.signup';
|
|
250
|
+
// // if (authEvent.queueEnabled) { //queue not supported
|
|
251
|
+
// // authUserSignupKey = 'user.signup.queue';
|
|
252
|
+
// // }
|
|
253
|
+
// winston.info('ActivityArchiver authUserSignupKey: ' + authUserSignupKey);
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
// authEvent.on(authUserSignupKey, function(event) {
|
|
257
|
+
// setImmediate(() => {
|
|
258
|
+
// if (event.skipArchive) {
|
|
259
|
+
// return 0;
|
|
260
|
+
// }
|
|
261
|
+
|
|
262
|
+
// var activity = new Activity({actor: {type:"user", id: event.savedUser._id, name: event.savedUser.fullName },
|
|
263
|
+
// verb: "USER_SIGNUP", actionObj: event.req.body,
|
|
264
|
+
// target: {type:"user", id: event.savedUser._id.toString(), object: null },
|
|
265
|
+
// id_project: '*' }); /// * project
|
|
266
|
+
// that.save(activity);
|
|
195
267
|
|
|
196
|
-
|
|
197
|
-
|
|
268
|
+
// });
|
|
269
|
+
// });
|
|
198
270
|
|
|
199
|
-
authEvent.on('user.signup.error', function(event) {
|
|
200
|
-
setImmediate(() => {
|
|
201
|
-
if (event.skipArchive) {
|
|
202
|
-
return 0;
|
|
203
|
-
}
|
|
204
271
|
|
|
272
|
+
// var authUserSignupErrorKey = 'user.signup.error';
|
|
273
|
+
// // if (authEvent.queueEnabled) { //queue not supported
|
|
274
|
+
// // authUserSignupErrorKey = 'user.signup.error.queue';
|
|
275
|
+
// // }
|
|
276
|
+
// winston.info('ActivityArchiver authUserSignupErrorKey: ' + authUserSignupErrorKey);
|
|
205
277
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
278
|
+
|
|
279
|
+
// authEvent.on(authUserSignupErrorKey, function(event) {
|
|
280
|
+
// setImmediate(() => {
|
|
281
|
+
// if (event.skipArchive) {
|
|
282
|
+
// return 0;
|
|
283
|
+
// }
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
// var activity = new Activity({actor: {type:"user"},
|
|
287
|
+
// verb: "USER_SIGNUP_ERROR", actionObj: event.req.body,
|
|
288
|
+
// target: {type:"user", id:null, object: null },
|
|
289
|
+
// id_project: '*' }); /// * project
|
|
290
|
+
// that.save(activity);
|
|
211
291
|
|
|
212
|
-
|
|
213
|
-
|
|
292
|
+
// });
|
|
293
|
+
// });
|
|
214
294
|
|
|
215
|
-
|
|
216
|
-
|
|
295
|
+
|
|
296
|
+
var requestCreateKey = 'request.create';
|
|
297
|
+
if (requestEvent.queueEnabled) {
|
|
298
|
+
requestCreateKey = 'request.create.queue';
|
|
299
|
+
}
|
|
300
|
+
winston.info('ActivityArchiver requestCreateKey: ' + requestCreateKey);
|
|
301
|
+
|
|
302
|
+
requestEvent.on(requestCreateKey, function(request) {
|
|
303
|
+
setImmediate(() => {
|
|
304
|
+
winston.debug('ActivityArchiver requestCreate triggered');
|
|
217
305
|
// problema requester_id
|
|
218
306
|
|
|
219
307
|
// Error saving activity {"_id":"5e06189c6e226d358896d733","actor":{"_id":"5e06189c6e226d358896d734","type":"user","id":null},"verb":"REQUEST_CREATE","actionObj":{"status":200,"participants":["5e06189c6e226d358896d728"],"messages_count":0,"tags":[],"_id":"5e06189c6e226d358896d72e","request_id":"request_id-closeRequest","first_text":"first_text","department":{"routing":"assigned","default":true,"status":1,"_id":"5e06189c6e226d358896d72b","name":"Default Department","id_project":"5e06189c6e226d358896d729","createdBy":"5e06189c6e226d358896d728","createdAt":"2019-12-27T14:43:40.327Z","updatedAt":"2019-12-27T14:43:40.327Z","__v":0},"agents":[{"_id":"5e06189c6e226d358896d72a","id_project":"5e06189c6e226d358896d729","id_user":"5e06189c6e226d358896d728","role":"owner","user_available":true,"createdBy":"5e06189c6e226d358896d728","createdAt":"2019-12-27T14:43:40.324Z","updatedAt":"2019-12-27T14:43:40.324Z","__v":0}],"id_project":"5e06189c6e226d358896d729","createdBy":"requester_id1","channel":{"name":"chat21"},"createdAt":"2019-12-27T14:43:40.586Z","updatedAt":"2019-12-27T14:43:40.586Z","__v":0},"target":{"type":"request","id":"5e06189c6e226d358896d72e","object":{"status":200,"participants":["5e06189c6e226d358896d728"],"messages_count":0,"tags":[],"_id":"5e06189c6e226d358896d72e","request_id":"request_id-closeRequest","first_text":"first_text","department":{"routing":"assigned","default":true,"status":1,"_id":"5e06189c6e226d358896d72b","name":"Default Department","id_project":"5e06189c6e226d358896d729","createdBy":"5e06189c6e226d358896d728","createdAt":"2019-12-27T14:43:40.327Z","updatedAt":"2019-12-27T14:43:40.327Z","__v":0},"agents":[{"_id":"5e06189c6e226d358896d72a","id_project":"5e06189c6e226d358896d729","id_user":"5e06189c6e226d358896d728","role":"owner","user_available":true,"createdBy":"5e06189c6e226d358896d728","createdAt":"2019-12-27T14:43:40.324Z","updatedAt":"2019-12-27T14:43:40.324Z","__v":0}],"id_project":"5e06189c6e226d358896d729","createdBy":"requester_id1","channel":{"name":"chat21"},"createdAt":"2019-12-27T14:43:40.586Z","updatedAt":"2019-12-27T14:43:40.586Z","__v":0}},"id_project":"5e06189c6e226d358896d729"}
|
|
@@ -248,7 +336,17 @@ class ActivityArchiver {
|
|
|
248
336
|
});
|
|
249
337
|
|
|
250
338
|
|
|
251
|
-
|
|
339
|
+
// verified with queue
|
|
340
|
+
var requestUpdatePreflightKey = 'request.update.preflight';
|
|
341
|
+
if (requestEvent.queueEnabled) {
|
|
342
|
+
requestUpdatePreflightKey = 'request.update.preflight.queue';
|
|
343
|
+
}
|
|
344
|
+
winston.info('ActivityArchiver requestUpdatePreflightKey: ' + requestUpdatePreflightKey);
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
requestEvent.on(requestUpdatePreflightKey, function(request) {
|
|
348
|
+
winston.info('ActivityArchiver request.update.preflight: ');
|
|
349
|
+
|
|
252
350
|
setImmediate(() => {
|
|
253
351
|
|
|
254
352
|
try {
|
|
@@ -271,7 +369,16 @@ class ActivityArchiver {
|
|
|
271
369
|
});
|
|
272
370
|
|
|
273
371
|
|
|
274
|
-
|
|
372
|
+
|
|
373
|
+
// verified with queue
|
|
374
|
+
var requestCloseKey = 'request.close';
|
|
375
|
+
if (requestEvent.queueEnabled) {
|
|
376
|
+
requestCloseKey = 'request.close.queue';
|
|
377
|
+
}
|
|
378
|
+
winston.info('ActivityArchiver requestCloseKey: ' + requestCloseKey);
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
requestEvent.on(requestCloseKey, function(request) {
|
|
275
382
|
setImmediate(() => {
|
|
276
383
|
|
|
277
384
|
try {
|
|
@@ -92,6 +92,7 @@ listen() {
|
|
|
92
92
|
} else {
|
|
93
93
|
winston.debug("sendUserEmail chat channel");
|
|
94
94
|
|
|
95
|
+
//TODO mandare email se ultimo messaggio > X MINUTI configurato in Notification . potresti usare request.updated_at ?
|
|
95
96
|
|
|
96
97
|
|
|
97
98
|
|
|
@@ -123,7 +124,7 @@ listen() {
|
|
|
123
124
|
winston.debug('RequestNotification requestCreateKey: ' + requestCreateKey);
|
|
124
125
|
|
|
125
126
|
requestEvent.on(requestCreateKey, function(request) {
|
|
126
|
-
|
|
127
|
+
winston.debug('requestEvent.on(requestCreateKey');
|
|
127
128
|
setImmediate(() => {
|
|
128
129
|
|
|
129
130
|
/*
|
|
@@ -140,10 +141,9 @@ listen() {
|
|
|
140
141
|
|
|
141
142
|
|
|
142
143
|
var requestParticipantsUpdateKey = 'request.participants.update';
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// }
|
|
144
|
+
if (requestEvent.queueEnabled) {
|
|
145
|
+
requestParticipantsUpdateKey = 'request.participants.update.queue';
|
|
146
|
+
}
|
|
147
147
|
winston.debug('RequestNotification requestParticipantsUpdateKey: ' + requestParticipantsUpdateKey);
|
|
148
148
|
|
|
149
149
|
requestEvent.on(requestParticipantsUpdateKey, function(data) {
|
|
@@ -176,12 +176,12 @@ listen() {
|
|
|
176
176
|
// TODO Send email also for addAgent and reassign. Alessio request for pooled only?
|
|
177
177
|
|
|
178
178
|
var requestCloseExtendedKey = 'request.close.extended';
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
// }
|
|
179
|
+
if (requestEvent.queueEnabled) {
|
|
180
|
+
requestCloseExtendedKey = 'request.close.extended.queue';
|
|
181
|
+
}
|
|
183
182
|
winston.debug('RequestNotification requestCloseExtendedKey: ' + requestCloseExtendedKey);
|
|
184
183
|
requestEvent.on(requestCloseExtendedKey, function(data) {
|
|
184
|
+
winston.debug('requestEvent.on(requestCloseExtendedKey ' + requestCloseExtendedKey);
|
|
185
185
|
setImmediate(() => {
|
|
186
186
|
var request = data.request;
|
|
187
187
|
var notify = data.notify;
|
|
@@ -376,7 +376,7 @@ async notifyFollowers(savedRequest, project, message) {
|
|
|
376
376
|
// Cannot read property '_id' of undefined at RequestNotification.notifyFollowers (/usr/src/app/pubmodules/emailNotification/requestNotification.js:358:62) at /usr/src/app
|
|
377
377
|
// forse meglio .id
|
|
378
378
|
|
|
379
|
-
var reqWithFollowers = await Request.findById(savedRequest._id).populate('followers').exec();
|
|
379
|
+
var reqWithFollowers = await Request.findById(savedRequest._id).populate('followers').exec(); // cache_attention
|
|
380
380
|
winston.debug("reqWithFollowers");
|
|
381
381
|
winston.debug("reqWithFollowers",reqWithFollowers);
|
|
382
382
|
// console.log("reqWithFollowers",reqWithFollowers);
|
|
@@ -396,7 +396,7 @@ async notifyFollowers(savedRequest, project, message) {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
User.findOne({_id: userid , status: 100})
|
|
399
|
-
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+userid)
|
|
399
|
+
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+userid) //user_cache
|
|
400
400
|
.exec(function (err, user) {
|
|
401
401
|
if (err) {
|
|
402
402
|
// winston.debug(err);
|
|
@@ -538,7 +538,7 @@ sendToAgentEmailChannelEmail(projectid, message) {
|
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
User.findOne({_id: userid , status: 100})
|
|
541
|
-
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+userid)
|
|
541
|
+
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+userid) //user_cache
|
|
542
542
|
.exec(function (err, user) {
|
|
543
543
|
if (err) {
|
|
544
544
|
// winston.debug(err);
|
|
@@ -592,7 +592,7 @@ sendToAgentEmailChannelEmail(projectid, message) {
|
|
|
592
592
|
}
|
|
593
593
|
|
|
594
594
|
User.findOne({_id: assignedId, status: 100})
|
|
595
|
-
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+assignedId)
|
|
595
|
+
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+assignedId) //user_cache
|
|
596
596
|
.exec(function (err, user) {
|
|
597
597
|
if (err) {
|
|
598
598
|
winston.error("Error sending email to " + savedRequest.participants[0], err);
|
|
@@ -806,6 +806,7 @@ sendUserEmail(projectid, message) {
|
|
|
806
806
|
}
|
|
807
807
|
winston.debug("tokenQueryString: "+tokenQueryString);
|
|
808
808
|
|
|
809
|
+
//send email unverified so spam check?
|
|
809
810
|
emailService.sendNewMessageNotification(lead.email, message, project, tokenQueryString, sourcePage);
|
|
810
811
|
}
|
|
811
812
|
|
|
@@ -902,7 +903,7 @@ sendAgentEmail(projectid, savedRequest) {
|
|
|
902
903
|
}
|
|
903
904
|
|
|
904
905
|
User.findOne({_id: userid , status: 100})
|
|
905
|
-
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+userid)
|
|
906
|
+
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+userid) //user_cache
|
|
906
907
|
.exec(function (err, user) {
|
|
907
908
|
if (err) {
|
|
908
909
|
// winston.debug(err);
|
|
@@ -966,7 +967,7 @@ sendAgentEmail(projectid, savedRequest) {
|
|
|
966
967
|
return winston.warn("RequestNotification email notification for the user with id : " + assignedId + " not found project_user");
|
|
967
968
|
}
|
|
968
969
|
User.findOne({_id: assignedId, status: 100})
|
|
969
|
-
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+assignedId)
|
|
970
|
+
//@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+assignedId) //user_cache
|
|
970
971
|
.exec(function (err, user) {
|
|
971
972
|
if (err) {
|
|
972
973
|
winston.error("Error sending email to " + savedRequest.participants[0], err);
|
|
@@ -42,7 +42,10 @@ router.post('/', [
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
// // da qui
|
|
45
|
+
|
|
46
|
+
// performance log
|
|
45
47
|
// console.log("************* emit event"+new Date().toISOString());
|
|
48
|
+
|
|
46
49
|
// // message.senderFullname, message.recipient,
|
|
47
50
|
// // message.recipient_fullname, message.text, message.sender, attributes, message.type, message.metadata, timestamp, message.group
|
|
48
51
|
// var recipient = req.body.attributes.request_id;
|
|
@@ -103,7 +103,7 @@ class PubModulesManager {
|
|
|
103
103
|
init(config) {
|
|
104
104
|
winston.debug("PubModulesManager init");
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
this.jobsManager = config.jobsManager;
|
|
107
107
|
|
|
108
108
|
try {
|
|
109
109
|
this.appRules = require('./rules/appRules');
|
|
@@ -393,8 +393,8 @@ class PubModulesManager {
|
|
|
393
393
|
// job_here
|
|
394
394
|
if (this.emailNotification) {
|
|
395
395
|
try {
|
|
396
|
-
this.emailNotification.requestNotification.listen();
|
|
397
|
-
|
|
396
|
+
// this.emailNotification.requestNotification.listen();
|
|
397
|
+
this.jobsManager.listenEmailNotification(this.emailNotification);
|
|
398
398
|
winston.info("PubModulesManager emailNotification started.");
|
|
399
399
|
} catch(err) {
|
|
400
400
|
winston.info("PubModulesManager error starting requestNotification module", err);
|
|
@@ -413,8 +413,8 @@ class PubModulesManager {
|
|
|
413
413
|
// job_here
|
|
414
414
|
if (this.activityArchiver) {
|
|
415
415
|
try {
|
|
416
|
-
this.activityArchiver.listen();
|
|
417
|
-
|
|
416
|
+
// this.activityArchiver.listen();
|
|
417
|
+
this.jobsManager.listenActivityArchiver(this.activityArchiver);
|
|
418
418
|
winston.info("PubModulesManager activityArchiver started");
|
|
419
419
|
} catch(err) {
|
|
420
420
|
winston.info("PubModulesManager error starting activityArchiver module", err);
|