@tiledesk/tiledesk-server 2.2.32 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,17 +1,28 @@
1
1
 
2
+ # 2.2.35 -> PROD
3
+ - BugFix projection for /me service
2
4
 
5
+ # 2.2.34
6
+ - Added transcript webpage for users without system messages
7
+
8
+ # 2.2.33
9
+ - Request fulltext sort fix
10
+
11
+ # 2.2.32
12
+ - Added Arabic language for the widget
13
+ - Updated dependencies with npm update
14
+ - Filter requests by lead email
3
15
 
4
16
  # 2.2.31 (compatible with: Dashboard 2.2.37, Widget 5.0.25)
5
17
  - Fix email template reading from project.
6
- - Added transcript webpage for users without system messages
7
18
  - Fix export messages to csv
8
19
  - Fix ip address resolver
9
20
  - Exclude poweredBy field from widget endpoint
10
21
  - Bugfix when a conversation has a first_text with \agent
11
- - Added rasa chatbot chatbot type
22
+ - Added rasa chatbot chatbot type
12
23
  - Added visitor email and fullname in the fulltext index
13
24
 
14
- # 2.2.30 -> PROD
25
+ # 2.2.30
15
26
  - Log fix
16
27
 
17
28
  # 2.2.29
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.2.32",
4
+ "version": "2.2.35",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -49,4 +49,25 @@ var winston = require('../config/winston');
49
49
  });
50
50
 
51
51
 
52
+ router.get('/:requestid/messages-user.html', function(req, res) {
53
+
54
+ winston.debug(req.params);
55
+ winston.debug("here");
56
+ return Message.find({"recipient": req.params.requestid}).sort({createdAt: 'asc'}).exec(function(err, messages) {
57
+ if (err) {
58
+ return res.status(500).send({success: false, msg: 'Error getting object.'});
59
+ }
60
+
61
+ var messages = messages.filter(m => m.sender != "system" );
62
+
63
+ //skip info message
64
+ if(!messages){
65
+ return res.status(404).send({success: false, msg: 'Object not found.'});
66
+ }
67
+
68
+ return res.render('messages', { title: 'Tiledesk', messages: messages});
69
+ });
70
+
71
+ });
72
+
52
73
  module.exports = router;
package/routes/request.js CHANGED
@@ -837,12 +837,21 @@ router.get('/', function (req, res, next) {
837
837
 
838
838
  winston.verbose('REQUEST ROUTE - REQUEST FIND ', query);
839
839
 
840
+ var projection = undefined;
841
+
842
+ if (req.query.full_text) {
843
+ winston.info('fulltext projection');
844
+
845
+ projection = {score: { $meta: "textScore" } };
846
+ }
840
847
  // requestcachefarequi populaterequired
841
- var q1 = Request.find(query).
848
+ var q1 = Request.find(query, projection).
842
849
  skip(skip).limit(limit);
843
850
 
844
851
 
845
-
852
+
853
+
854
+
846
855
  winston.debug('REQUEST ROUTE no_populate:' + req.query.no_populate);
847
856
 
848
857
  if (req.query.no_populate != "true" && req.query.no_populate != true) {
@@ -863,7 +872,13 @@ router.get('/', function (req, res, next) {
863
872
  // // q1.select({ "snapshot": 1});
864
873
  // }
865
874
 
866
- q1.sort(sortQuery);
875
+ if (req.query.full_text) {
876
+ winston.info('fulltext sort');
877
+ q1.sort( { score: { $meta: "textScore" } } ) //https://docs.mongodb.com/manual/reference/operator/query/text/#sort-by-text-search-score
878
+ } else {
879
+ q1.sort(sortQuery);
880
+ }
881
+
867
882
 
868
883
  // winston.info('q1',q1);
869
884
 
@@ -1011,7 +1026,6 @@ router.get('/csv', function (req, res, next) {
1011
1026
 
1012
1027
 
1013
1028
 
1014
-
1015
1029
  winston.debug('REQUEST ROUTE - REQUEST FIND ', query)
1016
1030
  return Request.find(query, '-transcript -status -__v').
1017
1031
  skip(skip).limit(limit).
@@ -321,11 +321,18 @@ router.get('/me', function (req, res, next) {
321
321
 
322
322
  winston.verbose('REQUEST ROUTE - REQUEST FIND ', query);
323
323
 
324
+ var projection = undefined;
325
+
326
+ if (req.query.full_text) {
327
+ winston.debug('fulltext projection');
328
+
329
+ projection = {score: { $meta: "textScore" } };
330
+ }
324
331
  // requestcachefarequi populaterequired
325
- var q1 = Request.find(query).
332
+ var q1 = Request.find(query, projection).
326
333
  skip(skip).limit(limit);
327
334
 
328
-
335
+
329
336
  winston.debug('REQUEST ROUTE no_populate:' + req.query.no_populate);
330
337
 
331
338
  if (req.query.no_populate != "true" && req.query.no_populate != true) {
@@ -346,7 +353,12 @@ router.get('/me', function (req, res, next) {
346
353
  // // q1.select({ "snapshot": 1});
347
354
  // }
348
355
 
349
- q1.sort(sortQuery);
356
+ if (req.query.full_text) {
357
+ winston.debug('fulltext sort');
358
+ q1.sort( { score: { $meta: "textScore" } } ) //https://docs.mongodb.com/manual/reference/operator/query/text/#sort-by-text-search-score
359
+ } else {
360
+ q1.sort(sortQuery);
361
+ }
350
362
 
351
363
  // winston.info('q1',q1);
352
364
 
package/routes/widget.js CHANGED
@@ -116,7 +116,7 @@ router.get('/', function(req, res, next) {
116
116
 
117
117
 
118
118
  var getProject = function(req) {
119
- winston.info('getProject.');
119
+ winston.debug('getProject.');
120
120
 
121
121
  return new Promise(function (resolve, reject) {
122
122
 
@@ -130,7 +130,7 @@ router.get('/', function(req, res, next) {
130
130
  }
131
131
 
132
132
  if (project && project.profile && (project.profile.type === 'free' && project.trialExpired === true) || (project.profile.type === 'payment' && project.isActiveSubscription === false)) {
133
- winston.info('getProject remove poweredBy tag', project);
133
+ winston.debug('getProject remove poweredBy tag', project);
134
134
  project.widget.poweredBy = undefined;
135
135
  project.widget.baloonImage = undefined;
136
136
  }