@tiledesk/tiledesk-server 2.10.6 → 2.10.8

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.10.8
9
+ - Fix bug closing conversation by chatbot
10
+ - Fix bug typo error on import chatbot as json
11
+
12
+ # 2.10.7
13
+ - Update: removed regex in signup and changepsw (temp)
14
+ - Update: fire request.close event even if the request is already closed
15
+
8
16
  # 2.10.6
9
17
  - Update: return more chatbot info with restricted_mode
10
18
 
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.10.6",
4
+ "version": "2.10.8",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
package/routes/auth.js CHANGED
@@ -80,10 +80,10 @@ router.post('/signup',
80
80
 
81
81
  // TODO: move the regex control inside signup method of UserService.
82
82
  // Warning: the pwd used in every test must be changed!
83
- const regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/);
84
- if (!regex.test(req.body.password)) {
85
- return res.status(403).send({ success: false, message: "The password does not meet the minimum vulnerability requirements"})
86
- }
83
+ // const regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/);
84
+ // if (!regex.test(req.body.password)) {
85
+ // return res.status(403).send({ success: false, message: "The password does not meet the minimum vulnerability requirements"})
86
+ // }
87
87
 
88
88
  return userService.signup(req.body.email, req.body.password, req.body.firstname, req.body.lastname, false)
89
89
  .then( async function (savedUser) {
package/routes/faq_kb.js CHANGED
@@ -719,7 +719,7 @@ router.post('/importjson/:id_faq_kb', roleChecker.hasRole('admin'), upload.singl
719
719
 
720
720
  if (faq) {
721
721
  winston.debug("new intent created")
722
- faqBotEvent.emit('faq.create', savedFaq);
722
+ faqBotEvent.emit('faq.create', faq);
723
723
  }
724
724
  })
725
725
  }
package/routes/request.js CHANGED
@@ -306,12 +306,20 @@ router.patch('/:requestid', function (req, res) {
306
306
  router.put('/:requestid/close', async function (req, res) {
307
307
  winston.debug(req.body);
308
308
  let request_id = req.params.requestid;
309
- let user_role = req.projectuser.role;
309
+
310
+ /**
311
+ * Check on projectuser existence.
312
+ * If req.projectuser is null then the request was made by a chatbot.
313
+ */
314
+ let project_user = req.projectuser;
315
+ let user_role;
316
+ if (project_user) {
317
+ user_role = project_user.role;
318
+ }
310
319
 
311
- // closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by)
312
320
  const closed_by = req.user.id;
313
321
 
314
- if (user_role !== RoleConstants.OWNER && user_role !== RoleConstants.ADMIN) {
322
+ if (user_role && (user_role !== RoleConstants.OWNER && user_role !== RoleConstants.ADMIN)) {
315
323
  let request = await Request.findOne({ id_project: req.projectid, request_id: request_id }).catch((err) => {
316
324
  winston.error("Error finding request: ", err);
317
325
  return res.status(500).send({ success: false, error: "Error finding request with request_id " + request_id })
@@ -327,7 +335,6 @@ router.put('/:requestid/close', async function (req, res) {
327
335
  return res.status(403).send({ success: false, error: "You must be among the participants to close a conversation."})
328
336
  }
329
337
  }
330
-
331
338
 
332
339
  return requestService.closeRequestByRequestId(req.params.requestid, req.projectid, false, true, closed_by, req.body.force).then(function (closedRequest) {
333
340
  winston.verbose("request closed", closedRequest);
package/routes/users.js CHANGED
@@ -137,10 +137,10 @@ router.put('/changepsw', function (req, res) {
137
137
  return res.status(403).send({ success: false, message: "The new password must be different from the previous one."})
138
138
  }
139
139
 
140
- const regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/);
141
- if (!regex.test(req.body.newpsw)) {
142
- return res.status(403).send({ success: false, message: "The password does not meet the minimum vulnerability requirements"})
143
- }
140
+ // const regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/);
141
+ // if (!regex.test(req.body.newpsw)) {
142
+ // return res.status(403).send({ success: false, message: "The password does not meet the minimum vulnerability requirements"})
143
+ // }
144
144
 
145
145
  user.password = req.body.newpsw
146
146
 
@@ -1749,6 +1749,7 @@ class RequestService {
1749
1749
  if (force == false && request.status == RequestConstants.CLOSED) {
1750
1750
  // qui1000
1751
1751
  // if (request.statusObj.closed) {
1752
+ requestEvent.emit('request.close', request);
1752
1753
  winston.debug("Request already closed for request_id " + request_id + " and id_project " + id_project);
1753
1754
  return resolve(request);
1754
1755
  }