@tiledesk/tiledesk-server 2.3.15 → 2.3.16
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.
|
@@ -202,15 +202,14 @@ router.post('/', function (req, res) {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
|
|
207
206
|
|
|
208
207
|
var new_request = {
|
|
209
208
|
request_id: message.recipient, project_user_id:project_user_id, lead_id:createdLead._id, id_project:projectid, first_text:message.text,
|
|
210
209
|
departmentid:departmentid, sourcePage:sourcePage, language:language, userAgent:client, status:requestStatus, createdBy: undefined,
|
|
211
210
|
attributes:rAttributes, subject:undefined, preflight:false, channel:undefined, location:undefined,
|
|
212
211
|
lead:createdLead, requester:project_user
|
|
213
|
-
|
|
212
|
+
|
|
214
213
|
};
|
|
215
214
|
|
|
216
215
|
winston.debug("new_request", new_request);
|
|
@@ -296,18 +295,19 @@ router.post('/', function (req, res) {
|
|
|
296
295
|
// TODO it doesn't work for internal requests bacause participanets == message.sender⁄
|
|
297
296
|
if (request.participants && request.participants.indexOf(message.sender) > -1) { //update waiitng time if write an agent (member of participants)
|
|
298
297
|
winston.debug("updateWaitingTimeByRequestId");
|
|
298
|
+
|
|
299
299
|
return requestService.updateWaitingTimeByRequestId(request.request_id, request.id_project).then(function(upRequest) {
|
|
300
300
|
return res.json(upRequest);
|
|
301
301
|
});
|
|
302
302
|
}else {
|
|
303
|
+
|
|
303
304
|
return res.json(upRequest);
|
|
304
305
|
}
|
|
305
306
|
// });
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
});
|
|
307
|
+
}).catch(function(err){
|
|
308
|
+
winston.error("Error creating chat21 webhook message: "+ JSON.stringify({err: err, message: message}));
|
|
309
|
+
return res.status(500).send({success: false, msg: 'Error creating message', err:err });
|
|
310
|
+
});
|
|
311
311
|
|
|
312
312
|
|
|
313
313
|
|
|
@@ -568,6 +568,8 @@ router.post('/', function (req, res) {
|
|
|
568
568
|
return res.status(400).send({success: false, msg: "not a support conversation" });
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
+
|
|
572
|
+
|
|
571
573
|
if (user_id!="system"){
|
|
572
574
|
winston.debug("not a system conversation");
|
|
573
575
|
return res.status(400).send({success: false, msg: "not a system conversation" });
|
package/package.json
CHANGED
|
@@ -76,7 +76,6 @@ class ActivityArchiver {
|
|
|
76
76
|
|
|
77
77
|
authEvent.on('project_user.update', function(event) {
|
|
78
78
|
setImmediate(() => {
|
|
79
|
-
// console.log("project_user.update");
|
|
80
79
|
/*
|
|
81
80
|
2019-11-20T10:40:52.686991+00:00 app[web.1]: TypeError: Cannot read property '_id' of undefined
|
|
82
81
|
*/
|
|
@@ -272,6 +271,26 @@ class ActivityArchiver {
|
|
|
272
271
|
});
|
|
273
272
|
|
|
274
273
|
|
|
274
|
+
requestEvent.on('request.close', function(request) {
|
|
275
|
+
setImmediate(() => {
|
|
276
|
+
|
|
277
|
+
try {
|
|
278
|
+
winston.error('ActivityArchiver close');
|
|
279
|
+
|
|
280
|
+
var activity = new Activity({actor: {type:"user", id: request.closed_by},
|
|
281
|
+
verb: "REQUEST_CLOSE", actionObj: request,
|
|
282
|
+
target: {type:"request", id:request._id, object: request },
|
|
283
|
+
id_project: request.id_project });
|
|
284
|
+
that.save(activity);
|
|
285
|
+
} catch(e) {
|
|
286
|
+
winston.error('ActivityArchiver error saving activity',e);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
|
|
275
294
|
|
|
276
295
|
|
|
277
296
|
winston.info('ActivityArchiver listening');
|