@tiledesk/tiledesk-server 2.10.7 → 2.10.9

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.9
9
+ - Removed logs
10
+ - Updated tiledesk-apps to 1.0.26
11
+
12
+ # 2.10.8
13
+ - Fix bug closing conversation by chatbot
14
+ - Fix bug typo error on import chatbot as json
15
+
8
16
  # 2.10.7
9
17
  - Update: removed regex in signup and changepsw (temp)
10
18
  - Update: fire request.close event even if the request is already closed
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.7",
4
+ "version": "2.10.9",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -36,7 +36,7 @@
36
36
  "@tiledesk-ent/tiledesk-server-visitorcounter": "^1.1.1"
37
37
  },
38
38
  "dependencies": {
39
- "@tiledesk/tiledesk-apps": "^1.0.25",
39
+ "@tiledesk/tiledesk-apps": "^1.0.26",
40
40
  "@tiledesk/tiledesk-chat21-app": "^1.1.8",
41
41
  "@tiledesk/tiledesk-chatbot-templates": "^0.1.2",
42
42
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
@@ -220,8 +220,6 @@ router.get('/', function (req, res) {
220
220
  page = req.query.page;
221
221
  }
222
222
 
223
- console.log("req.user._id: ", req.user._id)
224
- console.log("req.user.id: ", req.user.id)
225
223
  var skip = page * limit;
226
224
  winston.debug('CannedResponse ROUTE - SKIP PAGE ', skip);
227
225
 
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);