@tiledesk/tiledesk-server 2.10.7 → 2.10.8
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/routes/faq_kb.js +1 -1
- package/routes/request.js +11 -4
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@
|
|
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
|
+
|
8
12
|
# 2.10.7
|
9
13
|
- Update: removed regex in signup and changepsw (temp)
|
10
14
|
- Update: fire request.close event even if the request is already closed
|
package/package.json
CHANGED
package/routes/faq_kb.js
CHANGED
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
|
-
|
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);
|