@tiledesk/tiledesk-server 2.3.39 → 2.3.41

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/CHANGELOG.md CHANGED
@@ -1,9 +1,16 @@
1
1
 
2
+
2
3
  💥 TILEDESK SERVER v2.3.39 💥
3
4
  🚀 TAGGED AND PUBLISHED ON NPM 🚀
4
5
  🚀 IN PRODUCTION 🚀
5
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.39)
6
7
 
8
+ # 2.3.41
9
+ - Added force parameter to close request
10
+
11
+ # 2.3.40
12
+ - logfix
13
+
7
14
  # 2.3.39
8
15
  - logfix
9
16
 
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.39",
4
+ "version": "2.3.41",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -40,7 +40,7 @@
40
40
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
41
41
  "@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
42
42
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
43
- "@tiledesk/tiledesk-tybot-connector": "^0.1.14",
43
+ "@tiledesk/tiledesk-tybot-connector": "^0.1.16",
44
44
  "@tiledesk/tiledesk-dialogflow-connector": "^1.7.4",
45
45
  "app-root-path": "^3.0.0",
46
46
  "bcrypt-nodejs": "0.0.3",
@@ -354,7 +354,7 @@ sendToUserEmailChannelEmail(projectid, message) {
354
354
  });
355
355
 
356
356
  } catch(e) {
357
- winston.error("Error sending email", {error:e, projectid:projectid, message:message});
357
+ winston.error("Error sending requestNotification email", {error:e, projectid:projectid, message:message});
358
358
  }
359
359
  }
360
360
 
@@ -459,7 +459,7 @@ sendToFollower(projectid, message) {
459
459
  }
460
460
  })
461
461
  } catch (e) {
462
- winston.warn("Error sending email", {error:e, projectid:projectid, message: message, savedRequest:savedRequest}); //it's better to view error email at this stage
462
+ winston.warn("Error sending requestNotification email", {error:e, projectid:projectid, message: message, savedRequest:savedRequest}); //it's better to view error email at this stage
463
463
  }
464
464
  }
465
465
 
@@ -595,7 +595,7 @@ sendToAgentEmailChannelEmail(projectid, message) {
595
595
  //@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+assignedId) //user_cache
596
596
  .exec(function (err, user) {
597
597
  if (err) {
598
- winston.error("Error sending email to " + savedRequest.participants[0], err);
598
+ winston.error("Error sending requestNotification email to " + savedRequest.participants[0], err);
599
599
  }
600
600
  if (!user) {
601
601
  winston.warn("User not found", savedRequest.participants[0]);
@@ -625,7 +625,7 @@ sendToAgentEmailChannelEmail(projectid, message) {
625
625
  });
626
626
 
627
627
  } catch (e) {
628
- winston.warn("Error sending email", {error:e, projectid:projectid, message: message, savedRequest:savedRequest}); //it's better to view error email at this stage
628
+ winston.warn("Error sending requestNotification email", {error:e, projectid:projectid, message: message, savedRequest:savedRequest}); //it's better to view error email at this stage
629
629
  }
630
630
  //end send email
631
631
 
@@ -666,7 +666,7 @@ sendEmailChannelTakingNotification(projectid, request) {
666
666
  });
667
667
 
668
668
  } catch(e) {
669
- winston.error("Error sending email", {error:e, projectid:projectid, message:message});
669
+ winston.error("Error sending requestNotification email", {error:e, projectid:projectid, message:message});
670
670
  }
671
671
  }
672
672
 
@@ -820,7 +820,7 @@ sendUserEmail(projectid, message) {
820
820
  });
821
821
 
822
822
  } catch(e) {
823
- winston.error("Error sending email", {error:e, projectid:projectid, message:message});
823
+ winston.error("Error sending requestNotification email", {error:e, projectid:projectid, message:message});
824
824
  }
825
825
  }
826
826
 
@@ -970,7 +970,7 @@ sendAgentEmail(projectid, savedRequest) {
970
970
  //@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+assignedId) //user_cache
971
971
  .exec(function (err, user) {
972
972
  if (err) {
973
- winston.error("Error sending email to " + savedRequest.participants[0], err);
973
+ winston.error("Error sending requestNotification email to " + savedRequest.participants[0], err);
974
974
  }
975
975
  if (!user) {
976
976
  winston.warn("User not found", savedRequest.participants[0]);
@@ -1018,7 +1018,7 @@ sendAgentEmail(projectid, savedRequest) {
1018
1018
  });
1019
1019
 
1020
1020
  } catch (e) {
1021
- winston.warn("Error sending email", {error:e, projectid:projectid, savedRequest:savedRequest}); //it's better to view error email at this stage
1021
+ winston.warn("Error sending requestNotification email", {error:e, projectid:projectid, savedRequest:savedRequest}); //it's better to view error email at this stage
1022
1022
  }
1023
1023
  //end send email
1024
1024
 
package/routes/request.js CHANGED
@@ -288,7 +288,7 @@ router.put('/:requestid/close', function (req, res) {
288
288
 
289
289
  // closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by)
290
290
  const closed_by = req.user.id;
291
- return requestService.closeRequestByRequestId(req.params.requestid, req.projectid, false, true, closed_by).then(function(closedRequest) {
291
+ return requestService.closeRequestByRequestId(req.params.requestid, req.projectid, false, true, closed_by, req.body.force).then(function(closedRequest) {
292
292
 
293
293
  winston.verbose("request closed", closedRequest);
294
294
 
@@ -272,7 +272,7 @@ class EmailService {
272
272
  if (mail.callback){
273
273
  mail.callback(error, {info:info});
274
274
  }
275
- return winston.error("Error sending email ", {error:error, mailOptions:mailOptions});
275
+ return winston.error("Error sending email ", {error:error, mailConfig: mail.config, mailOptions:mailOptions});
276
276
  }
277
277
  winston.verbose('Email sent:', {info: info});
278
278
  winston.debug('Email sent:', {info: info, mailOptions: mailOptions});
@@ -1019,12 +1019,19 @@ class RequestService {
1019
1019
  }
1020
1020
 
1021
1021
 
1022
- closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by) {
1022
+ closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by, force) {
1023
1023
 
1024
1024
  var that = this;
1025
1025
  return new Promise(function (resolve, reject) {
1026
1026
  // winston.debug("request_id", request_id);
1027
1027
 
1028
+ if (force==undefined) {
1029
+ winston.debug("force is undefined ");
1030
+ force = false;
1031
+ }
1032
+ // else {
1033
+ // winston.info("force is: " + force);
1034
+ // }
1028
1035
 
1029
1036
  return Request
1030
1037
  .findOne({request_id: request_id, id_project: id_project})
@@ -1045,13 +1052,15 @@ class RequestService {
1045
1052
  winston.error("Request not found for request_id "+ request_id + " and id_project " + id_project);
1046
1053
  return reject({"success":false, msg:"Request not found for request_id "+ request_id + " and id_project " + id_project});
1047
1054
  }
1048
- if (request.status == RequestConstants.CLOSED) {
1055
+ if (force == false && request.status == RequestConstants.CLOSED) {
1049
1056
  // qui1000
1050
1057
  // if (request.statusObj.closed) {
1051
1058
  winston.debug("Request already closed for request_id "+ request_id + " and id_project " + id_project);
1052
1059
  return resolve(request);
1053
1060
  }
1054
1061
 
1062
+ winston.debug("sono qui");
1063
+
1055
1064
  // un utente può chiudere se appartiene a participatingAgents oppure meglio agents del progetto?
1056
1065
 
1057
1066
 
package/test/faqRoute.js CHANGED
@@ -18,7 +18,6 @@ const path = require('path');
18
18
 
19
19
  var expect = chai.expect;
20
20
  var assert = chai.assert;
21
- var path = require('path');
22
21
 
23
22
  chai.use(chaiHttp);
24
23