@tiledesk/tiledesk-server 2.3.69 β 2.3.71
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 +15 -2
- package/channels/chat21/chat21WebHook.js +14 -5
- package/models/faq.js +4 -0
- package/models/message.js +9 -7
- package/package.json +2 -2
- package/routes/email.js +13 -7
- package/routes/faq.js +6 -0
- package/routes/faq_kb.js +12 -7
- package/routes/message.js +29 -12
- package/routes/project_user.js +2 -1
- package/services/emailService.js +4 -3
- package/services/messageService.js +2 -1
- package/services/requestService.js +13 -7
- package/template/email/assignedEmailMessage.html +21 -12
- package/template/email/assignedRequest.html +21 -12
- package/template/email/beenInvitedExistingUser.html +15 -6
- package/template/email/beenInvitedNewUser.html +15 -6
- package/template/email/emailDirect.html +15 -6
- package/template/email/newMessage.html +18 -9
- package/template/email/newMessageFollower.html +22 -13
- package/template/email/passwordChanged.html +15 -6
- package/template/email/pooledEmailMessage.html +21 -12
- package/template/email/pooledRequest.html +20 -11
- package/template/email/resetPassword.html +15 -6
- package/template/email/sendTranscript.html +6 -4
- package/template/email/ticket.html +17 -8
- package/template/email/verify.html +15 -5
- package/test/requestService.js +55 -4
- package/utils/recipientEmailUtil.js +66 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
π₯ TILEDESK SERVER v2.3.
|
|
3
|
+
π₯ TILEDESK SERVER v2.3.71 π₯
|
|
4
4
|
π TAGGED AND PUBLISHED ON NPM π
|
|
5
5
|
π IN PRODUCTION π
|
|
6
|
-
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.
|
|
6
|
+
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.71)
|
|
7
|
+
|
|
8
|
+
# 2.3.71
|
|
9
|
+
- Email service send email direct fit without request_id
|
|
10
|
+
- Removed strong from transcript email template
|
|
11
|
+
- Added for updateWaitingTimeByRequestId the field enable_populate
|
|
12
|
+
- Added cache for message send endpoint
|
|
13
|
+
- Added support to mention and group to mail endpoint
|
|
14
|
+
- Now user role can use /users/search (for smtp)
|
|
15
|
+
- Disable text validation for send message
|
|
16
|
+
- Logo email fix
|
|
17
|
+
|
|
18
|
+
# 2.3.70
|
|
19
|
+
- Update tiledesk-tybot-connector to 0.1.42
|
|
7
20
|
|
|
8
21
|
# 2.3.69
|
|
9
22
|
- Update tiledesk-dialogflow-connector to 1.8.3
|
|
@@ -210,7 +210,12 @@ router.post('/', function (req, res) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
// var auto_close;
|
|
214
|
+
|
|
215
|
+
// // qui projecy nn c'Γ¨ devi leggerlo
|
|
216
|
+
// // if (req.project.attributes.auto_close === false) {
|
|
217
|
+
// // auto_close = 10;
|
|
218
|
+
// // }
|
|
214
219
|
|
|
215
220
|
|
|
216
221
|
var new_request = {
|
|
@@ -218,7 +223,7 @@ router.post('/', function (req, res) {
|
|
|
218
223
|
departmentid:departmentid, sourcePage:sourcePage, language:language, userAgent:client, status:requestStatus, createdBy: undefined,
|
|
219
224
|
attributes:rAttributes, subject:undefined, preflight:false, channel:undefined, location:undefined,
|
|
220
225
|
lead:createdLead, requester:project_user
|
|
221
|
-
|
|
226
|
+
// , auto_close: auto_close
|
|
222
227
|
};
|
|
223
228
|
|
|
224
229
|
winston.debug("new_request", new_request);
|
|
@@ -303,8 +308,8 @@ router.post('/', function (req, res) {
|
|
|
303
308
|
|
|
304
309
|
// TODO it doesn't work for internal requests bacause participanets == message.senderβ
|
|
305
310
|
if (request.participants && request.participants.indexOf(message.sender) > -1) { //update waiitng time if write an agent (member of participants)
|
|
306
|
-
winston.debug("updateWaitingTimeByRequestId");
|
|
307
|
-
return requestService.updateWaitingTimeByRequestId(request.request_id, request.id_project).then(function(upRequest) {
|
|
311
|
+
winston.debug("updateWaitingTimeByRequestId*******");
|
|
312
|
+
return requestService.updateWaitingTimeByRequestId(request.request_id, request.id_project, false).then(function(upRequest) {
|
|
308
313
|
return res.json(upRequest);
|
|
309
314
|
});
|
|
310
315
|
}else {
|
|
@@ -486,6 +491,10 @@ router.post('/', function (req, res) {
|
|
|
486
491
|
|
|
487
492
|
winston.debug("request",request.toObject());
|
|
488
493
|
// lead_id used. Change it?
|
|
494
|
+
|
|
495
|
+
// winston.info("request.snapshot.lead",request.snapshot.lead);
|
|
496
|
+
// if (request.snapshot.lead && request.snapshot.lead.lead_id==new_member) {
|
|
497
|
+
|
|
489
498
|
if (request.lead && request.lead.lead_id==new_member) {
|
|
490
499
|
winston.debug("don't joining request.lead or a lead");
|
|
491
500
|
return res.status(400).send({success: false, msg: "don't joining request.lead or a lead" });
|
|
@@ -612,7 +621,7 @@ router.post('/', function (req, res) {
|
|
|
612
621
|
}
|
|
613
622
|
else if (req.body.event_type == "typing-start") {
|
|
614
623
|
|
|
615
|
-
winston.debug("event_type
|
|
624
|
+
winston.debug("event_type typing-start");
|
|
616
625
|
|
|
617
626
|
winston.debug("typing-start req.body",req.body);
|
|
618
627
|
|
package/models/faq.js
CHANGED
package/models/message.js
CHANGED
|
@@ -45,13 +45,13 @@ var MessageSchema = new Schema({
|
|
|
45
45
|
},
|
|
46
46
|
text: {
|
|
47
47
|
type: String,
|
|
48
|
-
required: function() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
48
|
+
// required: function() {
|
|
49
|
+
// if (this.type === "text") {
|
|
50
|
+
// return true;
|
|
51
|
+
// }else {
|
|
52
|
+
// return false;
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
55
|
},
|
|
56
56
|
language: { //ISO 639-1 (Two letter codes) https://docs.mongodb.com/manual/reference/text-search-languages/#text-search-languages
|
|
57
57
|
type: String,
|
|
@@ -97,6 +97,8 @@ MessageSchema.index({ recipient: 1, updatedAt:1 });
|
|
|
97
97
|
MessageSchema.index({ id_project: 1, recipient:1, updatedAt: 1 });
|
|
98
98
|
MessageSchema.index({ id_project: 1, "attributes._answerid": 1 });
|
|
99
99
|
|
|
100
|
+
|
|
101
|
+
|
|
100
102
|
// https://docs.mongodb.com/manual/core/index-text/
|
|
101
103
|
// https://docs.mongodb.com/manual/tutorial/specify-language-for-text-index/
|
|
102
104
|
// https://docs.mongodb.com/manual/reference/text-search-languages/#text-search-languages
|
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.
|
|
4
|
+
"version": "2.3.71",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node ./bin/www",
|
|
7
7
|
"pretest": "mongodb-runner start",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@tiledesk/tiledesk-chatbot-util": "^0.8.33",
|
|
43
43
|
"@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
|
|
44
44
|
"@tiledesk/tiledesk-rasa-connector": "^1.0.10",
|
|
45
|
-
"@tiledesk/tiledesk-tybot-connector": "^0.1.
|
|
45
|
+
"@tiledesk/tiledesk-tybot-connector": "^0.1.42",
|
|
46
46
|
"@tiledesk/tiledesk-dialogflow-connector": "^1.8.3",
|
|
47
47
|
"app-root-path": "^3.0.0",
|
|
48
48
|
"bcrypt-nodejs": "0.0.3",
|
package/routes/email.js
CHANGED
|
@@ -4,6 +4,9 @@ var router = express.Router();
|
|
|
4
4
|
|
|
5
5
|
var emailService = require("../services/emailService");
|
|
6
6
|
var winston = require('../config/winston');
|
|
7
|
+
const recipientEmailUtil = require("../utils/recipientEmailUtil");
|
|
8
|
+
|
|
9
|
+
|
|
7
10
|
|
|
8
11
|
router.get('/templates/:templateid',
|
|
9
12
|
async (req, res) => {
|
|
@@ -29,25 +32,28 @@ router.post('/test/send',
|
|
|
29
32
|
|
|
30
33
|
});
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
//TODO add cc
|
|
33
36
|
router.post('/send',
|
|
34
37
|
async (req, res) => {
|
|
35
38
|
let to = req.body.to;
|
|
36
|
-
winston.
|
|
39
|
+
winston.debug("to: " + to);
|
|
37
40
|
|
|
38
41
|
let text = req.body.text;
|
|
39
|
-
winston.
|
|
42
|
+
winston.debug("text: " + text);
|
|
40
43
|
|
|
41
44
|
let request_id = req.body.request_id;
|
|
42
|
-
winston.
|
|
45
|
+
winston.debug("request_id: " + request_id);
|
|
43
46
|
|
|
44
47
|
let subject = req.body.subject;
|
|
45
|
-
winston.
|
|
48
|
+
winston.debug("subject: " + subject);
|
|
49
|
+
|
|
50
|
+
winston.debug("req.project", req.project);
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
let newto = await recipientEmailUtil.process(to, req.projectid);
|
|
53
|
+
winston.debug("newto: " + newto);
|
|
48
54
|
|
|
49
55
|
//sendEmailDirect(to, text, project, request_id, subject, tokenQueryString, sourcePage)
|
|
50
|
-
emailService.sendEmailDirect(
|
|
56
|
+
emailService.sendEmailDirect(newto, text, req.project, request_id, subject, undefined, undefined);
|
|
51
57
|
|
|
52
58
|
res.json({"queued": true});
|
|
53
59
|
|
package/routes/faq.js
CHANGED
|
@@ -130,6 +130,9 @@ router.post('/', function (req, res) {
|
|
|
130
130
|
if (req.body.enabled != undefined) {
|
|
131
131
|
newFaq.enabled = req.body.enabled;
|
|
132
132
|
}
|
|
133
|
+
if (req.body.actions) {
|
|
134
|
+
newFaq.actions = req.body.actions
|
|
135
|
+
}
|
|
133
136
|
|
|
134
137
|
newFaq.save(function (err, savedFaq) {
|
|
135
138
|
if (err) {
|
|
@@ -194,6 +197,9 @@ router.put('/:faqid', function (req, res) {
|
|
|
194
197
|
if (req.body.form!=undefined) {
|
|
195
198
|
update.form = req.body.form;
|
|
196
199
|
}
|
|
200
|
+
if (req.body.actions != undefined) {
|
|
201
|
+
update.actions = req.body.actions;
|
|
202
|
+
}
|
|
197
203
|
|
|
198
204
|
Faq.findByIdAndUpdate(req.params.faqid, update, { new: true, upsert: true }, function (err, updatedFaq) {
|
|
199
205
|
if (err) {
|
package/routes/faq_kb.js
CHANGED
|
@@ -413,7 +413,9 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
413
413
|
json = req.body;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
|
|
416
|
+
winston.info("json source " + json_string)
|
|
417
|
+
|
|
418
|
+
if (req.query.intentsOnly && req.query.intentsOnly == "true") {
|
|
417
419
|
|
|
418
420
|
winston.info("intents only")
|
|
419
421
|
|
|
@@ -430,7 +432,8 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
430
432
|
form: intent.form,
|
|
431
433
|
enabled: intent.enabled,
|
|
432
434
|
webhook_enabled: intent.webhook_enabled,
|
|
433
|
-
language: intent.language
|
|
435
|
+
language: intent.language,
|
|
436
|
+
actions: intent.actions
|
|
434
437
|
}
|
|
435
438
|
|
|
436
439
|
// overwrite duplicated intents
|
|
@@ -471,7 +474,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
471
474
|
|
|
472
475
|
} else {
|
|
473
476
|
|
|
474
|
-
if (req.query.create == 'true') {
|
|
477
|
+
if (req.query.create && req.query.create == 'true') {
|
|
475
478
|
faqService.create(json.name, undefined, req.projectid, req.user.id, "tilebot", json.description, json.webhook_url, json.webhook_enabled, json.language, undefined, undefined, undefined).then((savedFaq_kb) => {
|
|
476
479
|
winston.debug("saved (and imported) faq kb: ", savedFaq_kb);
|
|
477
480
|
botEvent.emit('faqbot.create', savedFaq_kb);
|
|
@@ -489,7 +492,8 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
489
492
|
form: intent.form,
|
|
490
493
|
enabled: intent.enabled,
|
|
491
494
|
webhook_enabled: intent.webhook_enabled,
|
|
492
|
-
language: intent.language
|
|
495
|
+
language: intent.language,
|
|
496
|
+
actions: intent.actions
|
|
493
497
|
}
|
|
494
498
|
|
|
495
499
|
// TO DELETE: no used when req.query.create = 'true'
|
|
@@ -511,7 +515,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
511
515
|
|
|
512
516
|
})
|
|
513
517
|
|
|
514
|
-
|
|
518
|
+
// don't overwrite duplicated intents
|
|
515
519
|
} else {
|
|
516
520
|
Faq.create(new_faq, (err, savedFaq) => {
|
|
517
521
|
if (err) {
|
|
@@ -531,7 +535,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
531
535
|
return res.status(200).send(savedFaq_kb);
|
|
532
536
|
|
|
533
537
|
}).catch((err) => {
|
|
534
|
-
|
|
538
|
+
winston.error("error saving faq_kb: ", err);
|
|
535
539
|
return res.status(500).send(err);
|
|
536
540
|
})
|
|
537
541
|
|
|
@@ -585,7 +589,8 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), (req, res) =>
|
|
|
585
589
|
form: intent.form,
|
|
586
590
|
enabled: intent.enabled,
|
|
587
591
|
webhook_enabled: intent.webhook_enabled,
|
|
588
|
-
language: intent.language
|
|
592
|
+
language: intent.language,
|
|
593
|
+
actions: intent.actions
|
|
589
594
|
}
|
|
590
595
|
|
|
591
596
|
// overwrite duplicated intents
|
package/routes/message.js
CHANGED
|
@@ -49,13 +49,17 @@ async (req, res) => {
|
|
|
49
49
|
winston.debug('req.params: ', req.params);
|
|
50
50
|
winston.debug('req.params.request_id: ' + req.params.request_id);
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
52
|
+
// sponz: 4/01/23 disable it
|
|
53
|
+
// if (!req.body.text && (!req.body.type || req.body.type=="text") ) {
|
|
54
|
+
// return res.status(422).json({ errors: ["text field is required"] });
|
|
55
|
+
// }
|
|
56
|
+
// const errors = validationResult(req);
|
|
57
|
+
// if (!errors.isEmpty()) {
|
|
58
|
+
// return res.status(422).json({ errors: errors.array() });
|
|
59
|
+
// }
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
59
63
|
|
|
60
64
|
// TODO se sei agent non puoi cambiare sender
|
|
61
65
|
// verificare validazione invio immagine senza caption
|
|
@@ -247,7 +251,7 @@ async (req, res) => {
|
|
|
247
251
|
|
|
248
252
|
if (request.participants && request.participants.indexOf(sender) > -1) { //update waiitng time if write an agent (member of participants)
|
|
249
253
|
winston.debug("updateWaitingTimeByRequestId");
|
|
250
|
-
return requestService.updateWaitingTimeByRequestId(request.request_id, request.id_project).then(function(upRequest) {
|
|
254
|
+
return requestService.updateWaitingTimeByRequestId(request.request_id, request.id_project, true).then(function(upRequest) {
|
|
251
255
|
let message = savedMessage.toJSON();
|
|
252
256
|
message.request = upRequest;
|
|
253
257
|
|
|
@@ -257,13 +261,26 @@ async (req, res) => {
|
|
|
257
261
|
}else {
|
|
258
262
|
let message = savedMessage.toJSON();
|
|
259
263
|
|
|
260
|
-
|
|
264
|
+
winston.debug("getting request for response");
|
|
265
|
+
|
|
266
|
+
let q =
|
|
267
|
+
Request.findOne({request_id: request.request_id, id_project: request.id_project})
|
|
268
|
+
// request
|
|
269
|
+
.populate('lead')
|
|
261
270
|
.populate('department')
|
|
262
271
|
.populate('participatingBots')
|
|
263
272
|
.populate('participatingAgents')
|
|
264
273
|
// .populate('followers')
|
|
265
|
-
.populate({path:'requester',populate:{path:'id_user'}})
|
|
266
|
-
|
|
274
|
+
.populate({path:'requester',populate:{path:'id_user'}});
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
if (cacheEnabler.request) {
|
|
278
|
+
q.cache(cacheUtil.defaultTTL, request.id_project+":requests:request_id:"+request.request_id)
|
|
279
|
+
winston.debug('request cache enabled for messages');
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
q.exec(function (err, requestPopulated){
|
|
283
|
+
// q.execPopulate(function (err, requestPopulated){
|
|
267
284
|
|
|
268
285
|
if (err) {
|
|
269
286
|
return winston.error("Error gettting savedRequestPopulated for send Message", err);
|
|
@@ -282,7 +299,7 @@ async (req, res) => {
|
|
|
282
299
|
message: 'Error creating message endpoint: '+ JSON.stringify(err) + " " + JSON.stringify(req.body) ,
|
|
283
300
|
label: req.projectid
|
|
284
301
|
});
|
|
285
|
-
|
|
302
|
+
winston.error("Error creating message", err);
|
|
286
303
|
return res.status(500).send({success: false, msg: 'Error creating message', err:err });
|
|
287
304
|
});
|
|
288
305
|
|
package/routes/project_user.js
CHANGED
|
@@ -375,7 +375,8 @@ router.get('/:project_userid', [passport.authenticate(['basic', 'jwt'], { sessio
|
|
|
375
375
|
});
|
|
376
376
|
|
|
377
377
|
|
|
378
|
-
router.get('/users/search', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes('
|
|
378
|
+
router.get('/users/search', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes('user', ['subscription'])], async (req, res, next) => { //changed for smtp
|
|
379
|
+
// router.get('/users/search', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes('agent', ['subscription'])], async (req, res, next) => {
|
|
379
380
|
winston.debug("--> users search ");
|
|
380
381
|
|
|
381
382
|
if (!req.project) {
|
package/services/emailService.js
CHANGED
|
@@ -124,7 +124,7 @@ class EmailService {
|
|
|
124
124
|
}
|
|
125
125
|
winston.info('EmailService headers: ' + JSON.stringify(this.headers));
|
|
126
126
|
|
|
127
|
-
this.ccEnabled = false
|
|
127
|
+
this.ccEnabled = false //cc creates loop when you send an email with cc: support@tiledesk.com -> Tiledesk generates an email with ticket id with in cc support@tiledesk.com that loop
|
|
128
128
|
|
|
129
129
|
if (process.env.EMAIL_CC_ENABLED ==="true" || process.env.EMAIL_CC_ENABLED === true ) {
|
|
130
130
|
this.ccEnabled = true;
|
|
@@ -1463,6 +1463,7 @@ async sendEmailDirect(to, text, project, request_id, subject, tokenQueryString,
|
|
|
1463
1463
|
|
|
1464
1464
|
var replacements = {
|
|
1465
1465
|
project: project,
|
|
1466
|
+
request_id: request_id,
|
|
1466
1467
|
seamlessPage: sourcePage,
|
|
1467
1468
|
msgText: msgText,
|
|
1468
1469
|
tokenQueryString: tokenQueryString,
|
|
@@ -1474,7 +1475,7 @@ async sendEmailDirect(to, text, project, request_id, subject, tokenQueryString,
|
|
|
1474
1475
|
|
|
1475
1476
|
|
|
1476
1477
|
let replyTo;
|
|
1477
|
-
if (this.replyEnabled) {
|
|
1478
|
+
if (this.replyEnabled && request_id) {
|
|
1478
1479
|
replyTo = request_id + this.inboundDomainDomainWithAt;
|
|
1479
1480
|
}
|
|
1480
1481
|
|
|
@@ -1730,7 +1731,7 @@ async sendEmailDirect(to, text, project, request_id, subject, tokenQueryString,
|
|
|
1730
1731
|
// ok
|
|
1731
1732
|
|
|
1732
1733
|
async sendRequestTranscript(to, messages, request, project) {
|
|
1733
|
-
|
|
1734
|
+
winston.debug("sendRequestTranscript: "+to);
|
|
1734
1735
|
|
|
1735
1736
|
//if the request came from rabbit mq?
|
|
1736
1737
|
if (request.toJSON) {
|
|
@@ -17,7 +17,7 @@ class MessageService {
|
|
|
17
17
|
if (!id) {
|
|
18
18
|
return this.create(sender, senderFullname, recipient, text, id_project, createdBy, status, attributes, type, metadata, language);
|
|
19
19
|
} else {
|
|
20
|
-
winston.debug("Message changeStatus"
|
|
20
|
+
winston.debug("Message upsert changeStatus:"+ status);
|
|
21
21
|
return this.changeStatus(id, status);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -176,6 +176,7 @@ class MessageService {
|
|
|
176
176
|
// attento giΓ scatta su chat21handler
|
|
177
177
|
|
|
178
178
|
changeStatus(message_id, newstatus) {
|
|
179
|
+
winston.debug("changeStatus. "+message_id + " "+ newstatus);
|
|
179
180
|
var that = this;
|
|
180
181
|
return new Promise(function (resolve, reject) {
|
|
181
182
|
// winston.debug("request_id", request_id);
|
|
@@ -970,19 +970,25 @@ class RequestService {
|
|
|
970
970
|
|
|
971
971
|
}
|
|
972
972
|
|
|
973
|
-
updateWaitingTimeByRequestId(request_id, id_project) {
|
|
973
|
+
updateWaitingTimeByRequestId(request_id, id_project, enable_populate) {
|
|
974
974
|
|
|
975
975
|
return new Promise(function (resolve, reject) {
|
|
976
976
|
// winston.debug("request_id", request_id);
|
|
977
977
|
// winston.debug("newstatus", newstatus);
|
|
978
978
|
|
|
979
979
|
let q = Request
|
|
980
|
-
.findOne({request_id: request_id, id_project: id_project})
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
980
|
+
.findOne({request_id: request_id, id_project: id_project});
|
|
981
|
+
|
|
982
|
+
if (enable_populate==true) {
|
|
983
|
+
winston.debug("updateWaitingTimeByRequestId enable_populate");
|
|
984
|
+
|
|
985
|
+
q.populate('lead')
|
|
986
|
+
.populate('department')
|
|
987
|
+
.populate('participatingBots')
|
|
988
|
+
.populate('participatingAgents')
|
|
989
|
+
.populate({path:'requester',populate:{path:'id_user'}});
|
|
990
|
+
}
|
|
991
|
+
|
|
986
992
|
|
|
987
993
|
// if (cacheEnabler.request) { //attention this cache is not usable bacause cacheoose don't support populate without .lean.. so if cached populated field is not returned with cacheoose, updateWaitingTime is only used in chat21webhook but i thik it is important for messages route
|
|
988
994
|
// q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id) //request_cache
|
|
@@ -11,9 +11,19 @@
|
|
|
11
11
|
img {
|
|
12
12
|
max-width: 100%;
|
|
13
13
|
margin-left:16px;
|
|
14
|
-
margin-bottom:16px;
|
|
15
14
|
text-align:center !important;
|
|
16
15
|
}
|
|
16
|
+
img.CToWUd {
|
|
17
|
+
margin-bottom: 16px;
|
|
18
|
+
max-width: 200px !important;
|
|
19
|
+
width: 200px !important;
|
|
20
|
+
min-width: 200px !important;
|
|
21
|
+
outline: none;
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
border: none;
|
|
24
|
+
height: auto;
|
|
25
|
+
margin-left: 0px;
|
|
26
|
+
}
|
|
17
27
|
body {
|
|
18
28
|
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
|
|
19
29
|
}
|
|
@@ -82,8 +92,7 @@
|
|
|
82
92
|
|
|
83
93
|
<div style="text-align:center">
|
|
84
94
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
|
85
|
-
|
|
86
|
-
<img src="https://tiledesk.com/wp-content/uploads/2022/09/tiledeesk_log_email.png" style="max-width:200px;outline:none;text-decoration:none;border:none;height:auto;margin-left:0px;" class="CToWUd">
|
|
95
|
+
<img src="https://tiledesk.com/wp-content/uploads/2023/01/tiledesk_log_email_200.png" class="CToWUd">
|
|
87
96
|
</a>
|
|
88
97
|
</div>
|
|
89
98
|
</tr>
|
|
@@ -103,7 +112,7 @@
|
|
|
103
112
|
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
104
113
|
|
|
105
114
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
106
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
115
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
107
116
|
{{#ifEquals message.type "text"}}
|
|
108
117
|
<div style="white-space: pre-wrap;">{{{msgText}}}</div>
|
|
109
118
|
{{/ifEquals}}
|
|
@@ -121,26 +130,26 @@
|
|
|
121
130
|
|
|
122
131
|
|
|
123
132
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
124
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
133
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
125
134
|
Project name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{project.name}}</strong>
|
|
126
135
|
</td>
|
|
127
136
|
</tr>
|
|
128
137
|
|
|
129
138
|
|
|
130
139
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
131
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
140
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
132
141
|
Department name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.department.name}}</strong>
|
|
133
142
|
</td>
|
|
134
143
|
</tr>
|
|
135
144
|
|
|
136
145
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
137
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
146
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
138
147
|
From email : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.lead.email}}</strong>
|
|
139
148
|
</td>
|
|
140
149
|
</tr>
|
|
141
150
|
|
|
142
151
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
143
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
152
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
144
153
|
Contact name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.lead.fullname}}</strong>
|
|
145
154
|
</td>
|
|
146
155
|
</tr>
|
|
@@ -152,7 +161,7 @@
|
|
|
152
161
|
</tr> -->
|
|
153
162
|
|
|
154
163
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
155
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
164
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
156
165
|
Channel : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
157
166
|
{{#ifEquals request.channel.name "chat21"}}
|
|
158
167
|
Chat
|
|
@@ -164,7 +173,7 @@
|
|
|
164
173
|
</tr>
|
|
165
174
|
|
|
166
175
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
167
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
176
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
168
177
|
<a href="{{baseScope.baseUrl}}/#/project/{{request.id_project}}/wsrequest/{{request.request_id}}/messages">Open the dashboard</a>.
|
|
169
178
|
|
|
170
179
|
</td>
|
|
@@ -175,7 +184,7 @@
|
|
|
175
184
|
|
|
176
185
|
|
|
177
186
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
178
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
|
187
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
|
179
188
|
</td>
|
|
180
189
|
</tr>
|
|
181
190
|
</table>
|
|
@@ -185,7 +194,7 @@
|
|
|
185
194
|
<div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
|
|
186
195
|
<table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
187
196
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
|
188
|
-
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;
|
|
197
|
+
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;" align="center" valign="top">
|
|
189
198
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
|
190
199
|
<br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span>
|
|
191
200
|
</td>
|