@tiledesk/tiledesk-server 2.3.4 → 2.3.7

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
- // var auto_close;
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
- // , auto_close: auto_close
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.debug("event_type","deleted-archivedconversation");
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.debug("user_id",user_id);
556
+ winston.info("user_id",user_id);
563
557
 
564
558
  var recipient_id = req.body.recipient_id;
565
- winston.debug("recipient_id",recipient_id);
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.debug("not a support conversation");
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.debug("not a system conversation");
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.debug("id_project", id_project);
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.3.4",
4
+ "version": "2.3.7",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -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" : false, messagelabel: {key: "CHAT_REOPENED"}},
231
+ 'system',
232
+ {subtype:"info/support", "updateconversation" : true, messagelabel: {key: "CHAT_REOPENED"}},
233
233
  undefined,
234
234
  request.language
235
235
 
package/routes/faq.js CHANGED
@@ -299,10 +299,17 @@ router.get('/', function (req, res, next) {
299
299
  query.id_project = req.projectid
300
300
  }
301
301
 
302
+ if (req.query.intent_display_name) {
303
+ query.intent_display_name=req.query.intent_display_name
304
+ }
305
+
306
+
302
307
  winston.debug("GET FAQ query", query);
303
308
 
304
309
  // query.$text = {"$search": "question"};
305
310
 
311
+
312
+
306
313
  return Faq.find(query).
307
314
  skip(skip).limit(limit).
308
315
  populate({path:'faq_kb'})//, match: { trashed: { $in: [null, false] } }}).
@@ -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
 
@@ -337,6 +340,9 @@ var printer = new PdfPrinter(fonts);
337
340
  });
338
341
 
339
342
 
343
+ res.setHeader('Content-Type', 'applictext/csv');
344
+ res.setHeader('Content-Disposition', 'attachment; filename=transcript.csv');
345
+
340
346
  return res.csv(messages, true);
341
347
  });
342
348
 
package/routes/request.js CHANGED
@@ -954,7 +954,9 @@ router.get('/', function (req, res, next) {
954
954
 
955
955
  if (req.query.full_text) {
956
956
  winston.debug('fulltext sort');
957
- q1.sort( { score: { $meta: "textScore" } } ) //https://docs.mongodb.com/manual/reference/operator/query/text/#sort-by-text-search-score
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
+ }
958
960
  } else {
959
961
  q1.sort(sortQuery);
960
962
  }