@tiledesk/tiledesk-server 2.3.3 → 2.3.6
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,20 +202,14 @@ router.post('/', function (req, res) {
|
|
202
202
|
}
|
203
203
|
|
204
204
|
|
205
|
-
|
206
|
-
|
207
|
-
// // qui projecy nn c'è devi leggerlo
|
208
|
-
// if (req.project.attributes.auto_close === false) {
|
209
|
-
// auto_close = 10;
|
210
|
-
// }
|
211
|
-
|
205
|
+
|
212
206
|
|
213
207
|
var new_request = {
|
214
208
|
request_id: message.recipient, project_user_id:project_user_id, lead_id:createdLead._id, id_project:projectid, first_text:message.text,
|
215
209
|
departmentid:departmentid, sourcePage:sourcePage, language:language, userAgent:client, status:requestStatus, createdBy: undefined,
|
216
210
|
attributes:rAttributes, subject:undefined, preflight:false, channel:undefined, location:undefined,
|
217
211
|
lead:createdLead, requester:project_user
|
218
|
-
|
212
|
+
|
219
213
|
};
|
220
214
|
|
221
215
|
winston.debug("new_request", new_request);
|
@@ -543,9 +537,9 @@ router.post('/', function (req, res) {
|
|
543
537
|
});
|
544
538
|
}
|
545
539
|
|
546
|
-
else if (req.body.event_type == "deleted-archivedconversation") {
|
540
|
+
else if (req.body.event_type == "deleted-archivedconversation" || req.body.event_type == "conversation-unarchived") {
|
547
541
|
|
548
|
-
winston.
|
542
|
+
winston.info("event_type","deleted-archivedconversation");
|
549
543
|
|
550
544
|
winston.debug("req.body",req.body);
|
551
545
|
|
@@ -559,21 +553,21 @@ router.post('/', function (req, res) {
|
|
559
553
|
// winston.debug("conversation",conversation);
|
560
554
|
|
561
555
|
var user_id = req.body.user_id;
|
562
|
-
winston.
|
556
|
+
winston.info("user_id",user_id);
|
563
557
|
|
564
558
|
var recipient_id = req.body.recipient_id;
|
565
|
-
winston.
|
559
|
+
winston.info("recipient_id",recipient_id);
|
566
560
|
|
567
561
|
|
568
562
|
// TODO leggi projectid from support-group
|
569
563
|
|
570
564
|
if (!recipient_id.startsWith("support-group")){
|
571
|
-
winston.
|
565
|
+
winston.info("not a support conversation");
|
572
566
|
return res.status(400).send({success: false, msg: "not a support conversation" });
|
573
567
|
}
|
574
568
|
|
575
569
|
if (user_id!="system"){
|
576
|
-
winston.
|
570
|
+
winston.info("not a system conversation");
|
577
571
|
return res.status(400).send({success: false, msg: "not a system conversation" });
|
578
572
|
}
|
579
573
|
|
@@ -582,9 +576,10 @@ router.post('/', function (req, res) {
|
|
582
576
|
if (conversation && conversation.attributes) {
|
583
577
|
id_project = conversation.attributes.projectId;
|
584
578
|
}else {
|
579
|
+
winston.info( "not a support deleting archived conversation" );
|
585
580
|
return res.status(400).send({success: false, msg: "not a support deleting archived conversation" });
|
586
581
|
}
|
587
|
-
winston.
|
582
|
+
winston.info("id_project", id_project);
|
588
583
|
|
589
584
|
|
590
585
|
return requestService.reopenRequestByRequestId(recipient_id, id_project).then(function(updatedRequest) {
|
package/package.json
CHANGED
@@ -188,7 +188,7 @@ devi mandare un messaggio welcome tu altrimenti il bot inserito successivamente
|
|
188
188
|
|
189
189
|
setImmediate(() => {
|
190
190
|
|
191
|
-
winston.debug("ConciergeBot send close bot message");
|
191
|
+
winston.debug("ConciergeBot send close bot message",request);
|
192
192
|
|
193
193
|
// send(sender, senderFullname, recipient, text, id_project, createdBy, attributes, type, metadata, language)
|
194
194
|
messageService.send(
|
@@ -198,7 +198,7 @@ devi mandare un messaggio welcome tu altrimenti il bot inserito successivamente
|
|
198
198
|
"Chat closed",
|
199
199
|
request.id_project,
|
200
200
|
'system',
|
201
|
-
{subtype:"info/support", "updateconversation" : false, messagelabel: {key: "CHAT_CLOSED"}},
|
201
|
+
{subtype:"info/support", "updateconversation" : false, messagelabel: {key: "CHAT_CLOSED"}},
|
202
202
|
undefined,
|
203
203
|
request.language
|
204
204
|
);
|
@@ -228,8 +228,8 @@ devi mandare un messaggio welcome tu altrimenti il bot inserito successivamente
|
|
228
228
|
request.request_id,
|
229
229
|
"Chat reopened",
|
230
230
|
request.id_project,
|
231
|
-
'system',
|
232
|
-
{subtype:"info/support", "updateconversation" :
|
231
|
+
'system',
|
232
|
+
{subtype:"info/support", "updateconversation" : true, messagelabel: {key: "CHAT_REOPENED"}},
|
233
233
|
undefined,
|
234
234
|
request.language
|
235
235
|
|
package/routes/public-request.js
CHANGED
@@ -86,6 +86,9 @@ var printer = new PdfPrinter(fonts);
|
|
86
86
|
delete element.attributes;
|
87
87
|
});
|
88
88
|
|
89
|
+
res.setHeader('Content-Type', 'applictext/csv');
|
90
|
+
res.setHeader('Content-Disposition', 'attachment; filename=transcript.csv');
|
91
|
+
|
89
92
|
return res.csv(messages, true);
|
90
93
|
});
|
91
94
|
|
@@ -170,6 +173,11 @@ var printer = new PdfPrinter(fonts);
|
|
170
173
|
|
171
174
|
var pdfDoc = printer.createPdfKitDocument(docDefinition);
|
172
175
|
// pdfDoc.pipe(fs.createWriteStream('lists.pdf'));
|
176
|
+
|
177
|
+
res.setHeader('Content-Type', 'application/pdf');
|
178
|
+
res.setHeader('Content-Disposition', 'attachment; filename=transcript.pdf');
|
179
|
+
|
180
|
+
|
173
181
|
pdfDoc.pipe(res);
|
174
182
|
pdfDoc.end();
|
175
183
|
|
@@ -287,6 +295,10 @@ var printer = new PdfPrinter(fonts);
|
|
287
295
|
|
288
296
|
var pdfDoc = printer.createPdfKitDocument(docDefinition);
|
289
297
|
// pdfDoc.pipe(fs.createWriteStream('lists.pdf'));
|
298
|
+
|
299
|
+
res.setHeader('Content-Type', 'application/pdf');
|
300
|
+
res.setHeader('Content-Disposition', 'attachment; filename=transcript.pdf');
|
301
|
+
|
290
302
|
pdfDoc.pipe(res);
|
291
303
|
pdfDoc.end();
|
292
304
|
|
@@ -328,6 +340,9 @@ var printer = new PdfPrinter(fonts);
|
|
328
340
|
});
|
329
341
|
|
330
342
|
|
343
|
+
res.setHeader('Content-Type', 'applictext/csv');
|
344
|
+
res.setHeader('Content-Disposition', 'attachment; filename=transcript.csv');
|
345
|
+
|
331
346
|
return res.csv(messages, true);
|
332
347
|
});
|
333
348
|
|
package/routes/request.js
CHANGED
@@ -656,6 +656,8 @@ router.delete('/id/:id', function (req, res) {
|
|
656
656
|
|
657
657
|
router.get('/', function (req, res, next) {
|
658
658
|
|
659
|
+
const startExecTime = new Date();
|
660
|
+
|
659
661
|
winston.debug("req projectid", req.projectid);
|
660
662
|
winston.debug("req.query.sort", req.query.sort);
|
661
663
|
winston.debug('REQUEST ROUTE - QUERY ', req.query)
|
@@ -910,14 +912,17 @@ router.get('/', function (req, res, next) {
|
|
910
912
|
|
911
913
|
winston.debug("sort query", sortQuery);
|
912
914
|
|
913
|
-
winston.
|
915
|
+
winston.debug('REQUEST ROUTE - REQUEST FIND ', query);
|
914
916
|
|
915
917
|
var projection = undefined;
|
916
918
|
|
917
919
|
if (req.query.full_text) {
|
918
|
-
winston.debug('fulltext projection');
|
919
920
|
|
920
|
-
|
921
|
+
if (req.query.no_textscore!= "true" && req.query.no_textscore!= true) {
|
922
|
+
winston.info('fulltext projection on');
|
923
|
+
projection = {score: { $meta: "textScore" } };
|
924
|
+
}
|
925
|
+
|
921
926
|
}
|
922
927
|
// requestcachefarequi populaterequired
|
923
928
|
var q1 = Request.find(query, projection).
|
@@ -949,7 +954,9 @@ router.get('/', function (req, res, next) {
|
|
949
954
|
|
950
955
|
if (req.query.full_text) {
|
951
956
|
winston.debug('fulltext sort');
|
952
|
-
|
957
|
+
if (req.query.no_textscore!= "true" && req.query.no_textscore!= true) {
|
958
|
+
q1.sort( { score: { $meta: "textScore" } } ) //https://docs.mongodb.com/manual/reference/operator/query/text/#sort-by-text-search-score
|
959
|
+
}
|
953
960
|
} else {
|
954
961
|
q1.sort(sortQuery);
|
955
962
|
}
|
@@ -965,6 +972,11 @@ router.get('/', function (req, res, next) {
|
|
965
972
|
|
966
973
|
var q2 = Request.countDocuments(query).exec();
|
967
974
|
|
975
|
+
if (req.query.no_count && req.query.no_count =="true") {
|
976
|
+
winston.info('REQUEST ROUTE - no_count ');
|
977
|
+
q2 = 0;
|
978
|
+
}
|
979
|
+
|
968
980
|
var promises = [
|
969
981
|
q1,
|
970
982
|
q2
|
@@ -978,6 +990,10 @@ router.get('/', function (req, res, next) {
|
|
978
990
|
};
|
979
991
|
winston.debug('REQUEST ROUTE - objectToReturn ');
|
980
992
|
winston.debug('REQUEST ROUTE - objectToReturn ', objectToReturn);
|
993
|
+
|
994
|
+
const endExecTime = new Date();
|
995
|
+
winston.info('REQUEST ROUTE - exec time: ' + (endExecTime-startExecTime));
|
996
|
+
|
981
997
|
return res.json(objectToReturn);
|
982
998
|
|
983
999
|
}).catch(function(err){
|