@tiledesk/tiledesk-server 2.1.4-0.31 → 2.1.4-0.35
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.
|
@@ -17,11 +17,16 @@ var ProjectUserUtil = require("../../utils/project_userUtil");
|
|
|
17
17
|
var RequestUtil = require("../../utils/requestUtil");
|
|
18
18
|
const authEvent = require('../../event/authEvent');
|
|
19
19
|
|
|
20
|
+
var syncJoinAndLeaveGroupEvent = false;
|
|
21
|
+
if (process.env.SYNC_JOIN_LEAVE_GROUP_EVENT === true || process.env.SYNC_JOIN_LEAVE_GROUP_EVENT ==="true") {
|
|
22
|
+
syncJoinAndLeaveGroupEvent = true;
|
|
23
|
+
}
|
|
24
|
+
winston.info("Chat21 Sync JoinAndLeave Support Group Event: " + syncJoinAndLeaveGroupEvent);
|
|
20
25
|
|
|
21
26
|
router.post('/', function (req, res) {
|
|
22
27
|
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
winston.debug("req.body.event_type: " + req.body.event_type);
|
|
25
30
|
|
|
26
31
|
//Deprecated
|
|
27
32
|
if (req.body.event_type == "message-sent" || req.body.event_type == "new-message") {
|
|
@@ -38,7 +43,7 @@ router.post('/', function (req, res) {
|
|
|
38
43
|
|
|
39
44
|
var message = req.body.data;
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
winston.debug("message text: " + message.text);
|
|
42
47
|
|
|
43
48
|
|
|
44
49
|
// before request_id id_project unique commented
|
|
@@ -77,10 +82,6 @@ router.post('/', function (req, res) {
|
|
|
77
82
|
|
|
78
83
|
var departmentid = "default";
|
|
79
84
|
|
|
80
|
-
// TODO 2020-04-20T14:38:56.954323+00:00 app[web.1]: info: MessageTransformerInterceptor message.create.simple.before {"beforeMessage":{"sender":"e06e10e8-24e9-47b1-b0c4-0ab8f8f576d2","senderFullname":"dario","recipient":"support-group-M5N0kHtNohGt8iCJiQy","text":"test 3","id_project":"5b55e806c93dde00143163dd","createdBy":"e06e10e8-24e9-47b1-b0c4-0ab8f8f576d2","status":200,"attributes":{"client":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4106.0 Mobile Safari/537.36","departmentId":"5c04ed747608f10015378fe8","departmentName":"Dipartimento 1","projectId":"5b55e806c93dde00143163dd","requester_id":"e06e10e8-24e9-47b1-b0c4-0ab8f8f576d2","sourcePage":"http://localhost:4200/test-custom-auth.html?tiledesk_callouttimer=2&tiledesk_isLogEnabled=true","userEmail":"test1@tiledesk.com","userFullname":"dario","senderAuthInfo":{"authType":"USER","authVar":{"token":{"aud":"chat21-pre-01","auth_time":1587392396,"exp":1587395996,"firebase":{"sign_in_provider":"custom"},"iat":1587392396,"iss":"https://securetoken.google.com/chat21-pre-01","sub":"e06e10e8-24e9-47b1-b0c4-0ab8f8f576d2","user_id":"e06e10e8-24e9-47b1-b0c4-0ab8f8f576d2"},"uid":"e06e10e8-24e9-47b1-b0c4-0ab8f8f576d2"}}},"type":"text","metadata":"","language":"it-IT"}}
|
|
81
|
-
// 2020-04-20T14:38:56.986907+00:00 app[web.1]: error: undefined {"driver":true,"name":"MongoError","index":0,"code":17262,"errmsg":"language override unsupported: IT-IT"}
|
|
82
|
-
// 2020-04-20T14:38:56.987274+00:00 app[web.1]: error: Error creating the request object.language override unsupported: IT-IT {"driver":true,"name":"MongoError","index":0,"code":17262,"errmsg":"language override unsupported: IT-IT","stack":"MongoError: language override unsupported: IT-IT\n at Function.create (/app/node_modules/mongodb/lib/core/error.js:44:12)\n at toError (/app/node_modules/mongodb/lib/utils.js:150:22)\n at coll.s.topology.insert (/app/node_modules/mongodb/lib/operations/common_functions.js:265:39)\n at handler (/app/node_modules/mongodb/lib/core/topologies/replset.js:1209:22)\n at /app/node_modules/mongodb/lib/core/connection/pool.js:420:18\n at processTicksAndRejections (internal/process/next_tick.js:74:9)"}
|
|
83
|
-
// 2020-04-20T14:38:57.027369+00:00 app[we
|
|
84
85
|
|
|
85
86
|
var language = message.language;
|
|
86
87
|
winston.debug("chat21 language", language);
|
|
@@ -415,6 +416,11 @@ router.post('/', function (req, res) {
|
|
|
415
416
|
|
|
416
417
|
winston.debug("req.body", JSON.stringify(req.body));
|
|
417
418
|
|
|
419
|
+
if (!syncJoinAndLeaveGroupEvent) {
|
|
420
|
+
winston.debug("syncJoinAndLeaveGroupEvent is disabled");
|
|
421
|
+
return res.status(200).send({success: true, msg: "syncJoinAndLeaveGroupEvent is disabled" });
|
|
422
|
+
}
|
|
423
|
+
|
|
418
424
|
var data = req.body.data;
|
|
419
425
|
//winston.debug("data",data);
|
|
420
426
|
|
|
@@ -480,6 +486,12 @@ router.post('/', function (req, res) {
|
|
|
480
486
|
|
|
481
487
|
winston.debug("req.body", JSON.stringify(req.body));
|
|
482
488
|
|
|
489
|
+
if (!syncJoinAndLeaveGroupEvent) {
|
|
490
|
+
winston.debug("syncJoinAndLeaveGroupEvent is disabled");
|
|
491
|
+
return res.status(200).send({success: true, msg: "syncJoinAndLeaveGroupEvent is disabled" });
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
|
|
483
495
|
|
|
484
496
|
var data = req.body.data;
|
|
485
497
|
// winston.debug("data",data);
|
|
@@ -698,6 +710,7 @@ else if (req.body.event_type == "presence-change") {
|
|
|
698
710
|
|
|
699
711
|
project_user.presence = update
|
|
700
712
|
|
|
713
|
+
|
|
701
714
|
project_user.save(function (err, savedProjectUser) {
|
|
702
715
|
if (err) {
|
|
703
716
|
winston.error('Error saving project_user ', err)
|
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.1.40.
|
|
4
|
+
"version": "2.1.40.35",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node ./bin/www",
|
|
7
7
|
"pretest": "mongodb-runner start",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tiledesk-ent/tiledesk-server-tags": "^1.1.1",
|
|
45
45
|
"@tiledesk-ent/tiledesk-server-groups": "^1.1.2",
|
|
46
46
|
"@tiledesk-ent/tiledesk-server-departments": "^1.1.2",
|
|
47
|
-
"@tiledesk-ent/tiledesk-server-mt": "^1.1.
|
|
47
|
+
"@tiledesk-ent/tiledesk-server-mt": "^1.1.7",
|
|
48
48
|
"@tiledesk-ent/tiledesk-server-visitorcounter": "^1.1.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
@@ -18,8 +18,7 @@ class MessageActionsInterceptor {
|
|
|
18
18
|
|
|
19
19
|
var that = this;
|
|
20
20
|
winston.info("MessageActionsInterceptor listener start ");
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
messageEvent.on('message.create', function(message) {
|
|
24
23
|
|
|
25
24
|
setImmediate(() => {
|
|
@@ -78,6 +77,7 @@ class MessageActionsInterceptor {
|
|
|
78
77
|
|
|
79
78
|
var request = message.request;
|
|
80
79
|
|
|
80
|
+
|
|
81
81
|
if (request) {
|
|
82
82
|
//var botId = botEvent.getBotId(message);
|
|
83
83
|
var botId = BotFromParticipant.getBotId(message);
|
|
@@ -144,14 +144,17 @@ class MessageActionsInterceptor {
|
|
|
144
144
|
var request = message.request;
|
|
145
145
|
|
|
146
146
|
if (request) {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
setTimeout(function() {
|
|
148
|
+
winston.info("delayed closed")
|
|
149
|
+
// closeRequestByRequestId(request_id, id_project, notify) {
|
|
150
|
+
requestService.closeRequestByRequestId(request.request_id, request.id_project );
|
|
151
|
+
}, 1500);
|
|
152
|
+
|
|
153
|
+
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
});
|
|
152
157
|
|
|
153
|
-
|
|
154
|
-
|
|
155
158
|
|
|
156
159
|
|
|
157
160
|
|
package/routes/images.js
CHANGED
|
@@ -23,7 +23,7 @@ const fileService = new FileGridFsService("images");
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
const fileFilter = (req, file, cb) => {
|
|
26
|
-
if (file.mimetype == 'image/jpeg' || file.mimetype == 'image/png') {
|
|
26
|
+
if (file.mimetype == 'image/jpeg' || file.mimetype == 'image/png' || file.mimetype == 'image/vnd.microsoft.icon') {
|
|
27
27
|
cb(null, true);
|
|
28
28
|
} else {
|
|
29
29
|
cb(null, false);
|
|
@@ -7,7 +7,7 @@ var winston = require('../config/winston');
|
|
|
7
7
|
|
|
8
8
|
// https://tiledesk-server-pre.herokuapp.com/requests_util/lookup/id_project/support-group-60ffe291f725db00347661ef-b4cb6875785c4a23b27244fe498eecf4
|
|
9
9
|
router.get('/lookup/id_project/:request_id', function(req, res) {
|
|
10
|
-
winston.
|
|
10
|
+
winston.debug("lookup: "+req.params.request_id);
|
|
11
11
|
|
|
12
12
|
return Request.findOne({request_id: req.params.request_id}).select("id_project").exec(function(err, request) {
|
|
13
13
|
if (err) {
|
|
@@ -16,7 +16,7 @@ router.get('/lookup/id_project/:request_id', function(req, res) {
|
|
|
16
16
|
if (!request) {
|
|
17
17
|
return res.status(404).send({success: false, msg: "Request with " + req.params.request_id + " not found" });
|
|
18
18
|
}
|
|
19
|
-
winston.
|
|
19
|
+
winston.debug("request",request);
|
|
20
20
|
res.json({id_project: request.id_project});
|
|
21
21
|
});
|
|
22
22
|
|