@tiledesk/tiledesk-server 2.1.4-0.3 → 2.1.4-0.31

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,44 @@
1
+ # Use the latest 2.1 version of CircleCI pipeline process engine.
2
+ # See: https://circleci.com/docs/2.0/configuration-reference
3
+ version: 2.1
4
+
5
+ orbs:
6
+ # The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize
7
+ # Orbs reduce the amount of configuration required for common tasks.
8
+ # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
9
+ node: circleci/node@4.1
10
+
11
+
12
+ jobs:
13
+ # Below is the definition of your job to build and test your app, you can rename and customize it as you want.
14
+ build-and-test:
15
+ # These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
16
+ # You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
17
+ # A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/node
18
+ docker:
19
+ - image: cimg/node:15.1
20
+ # Then run your tests!
21
+ # CircleCI will report the results back to your VCS provider.
22
+ steps:
23
+ # Checkout the code as the first step.
24
+ - checkout
25
+ # Next, the node orb's install-packages step will install the dependencies from a package.json.
26
+ # The orb install-packages step will also automatically cache them for faster future runs.
27
+ - node/install-packages
28
+ # If you are using yarn instead npm, remove the line above and uncomment the two lines below.
29
+ # - node/install-packages:
30
+ # pkg-manager: yarn
31
+ - run:
32
+ name: Run tests
33
+ command: npm test
34
+
35
+ workflows:
36
+ # Below is the definition of your workflow.
37
+ # Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
38
+ # CircleCI will run this workflow on every commit.
39
+ # For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
40
+ sample:
41
+ jobs:
42
+ - build-and-test
43
+ # For running simple node tests, you could optionally use the node/test job from the orb to replicate and replace the job above in fewer lines.
44
+ # - node/test
@@ -0,0 +1,22 @@
1
+ name: Docker Image Community latest CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ push_to_registry:
11
+ name: Push Docker image to Docker Hub
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ name: Check out the repo
17
+ - uses: docker/build-push-action@v1
18
+ with:
19
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
20
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
21
+ repository: tiledesk/tiledesk-server
22
+ tags: latest
@@ -1,4 +1,4 @@
1
- name: Publish Docker image
1
+ name: Publish Docker Enterprise Tag image
2
2
 
3
3
  on:
4
4
  push:
@@ -0,0 +1,21 @@
1
+ name: Publish Docker Community image tags
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '**' # Push events to every tag including hierarchical tags like
7
+ jobs:
8
+
9
+ push_to_registry:
10
+ name: Push Docker image to Docker Hub
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check out the repo
14
+ uses: actions/checkout@v2
15
+ - name: Push to Docker Hub
16
+ uses: docker/build-push-action@v1
17
+ with:
18
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
19
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
20
+ repository: tiledesk/tiledesk-server
21
+ tag_with_ref: true
@@ -1,4 +1,4 @@
1
- name: Docker Image CI
1
+ name: Docker Enterprise Latest Image CI
2
2
 
3
3
  on:
4
4
  push:
package/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
 
2
+ # 2.1.40.4
3
+ - BugFix messageConstants
4
+
2
5
  # 2.1.40.3
3
6
  - Bugfix first message with an image fix and touchText limited to 30 character or subject
4
7
  - Removed answer field from the fulltext search of the faqs
package/Dockerfile CHANGED
@@ -18,7 +18,7 @@ RUN if [ "$NPM_TOKEN" ]; \
18
18
  # where available (npm@5+)
19
19
  COPY package*.json ./
20
20
 
21
- RUN npm install
21
+ RUN npm install --production
22
22
 
23
23
  RUN rm -f .npmrc
24
24
 
package/Dockerfile-en CHANGED
@@ -13,7 +13,7 @@ COPY .npmrc_ .npmrc
13
13
  # where available (npm@5+)
14
14
  COPY package*.json ./
15
15
 
16
- RUN npm install
16
+ RUN npm install --production
17
17
 
18
18
  RUN rm -f .npmrc
19
19
 
package/app.js CHANGED
@@ -99,6 +99,8 @@ var cacheUtil = require("./utils/cacheUtil");
99
99
  var images = require('./routes/images');
100
100
  var files = require('./routes/files');
101
101
  var campaigns = require('./routes/campaigns');
102
+ var requestUtilRoot = require('./routes/requestUtilRoot');
103
+
102
104
 
103
105
  var bootDataLoader = require('./services/bootDataLoader');
104
106
  var settingDataLoader = require('./services/settingDataLoader');
@@ -133,6 +135,11 @@ try {
133
135
  }
134
136
 
135
137
 
138
+ //enterprise modules can modify pubmodule
139
+ modulesManager.start();
140
+
141
+ pubModulesManager.start();
142
+
136
143
 
137
144
  settingDataLoader.save();
138
145
  schemaMigrationService.checkSchemaMigration();
@@ -282,6 +289,8 @@ app.use('/widgets', widgetsLoader);
282
289
  app.use('/images', images);
283
290
  app.use('/files', files);
284
291
  app.use('/users', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken], users);
292
+ app.use('/requests_util', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken], requestUtilRoot);
293
+
285
294
 
286
295
  // TODO security issues
287
296
  if (process.env.DISABLE_TRANSCRIPT_VIEW_PAGE ) {
@@ -310,7 +319,6 @@ app.use('/:projectid/', [projectIdSetter, projectSetter]);
310
319
  app.use('/:projectid/authtestWithRoleCheck', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken], authtestWithRoleCheck);
311
320
 
312
321
  app.use('/:projectid/leads', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes('agent', ['bot','subscription'])], lead);
313
- // guest perche nn c'è guest???? no???
314
322
  app.use('/:projectid/requests/:request_id/messages', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes(null, ['bot','subscription'])] , message);
315
323
 
316
324
  app.use('/:projectid/messages', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes('agent', ['bot','subscription'])] , messagesRootRoute);
@@ -189,7 +189,7 @@ class Chat21Handler {
189
189
  setImmediate(() => {
190
190
  winston.debug("Chat21Handler on lead.update ", lead);
191
191
 
192
- // AGGIORNA SOLO SE PASSA DA GUEST A ALTRO??
192
+ // TODO AGGIORNA SOLO SE PASSA DA GUEST A ALTRO??
193
193
  Request.find({lead: lead._id, id_project: lead.id_project}, function(err, requests) {
194
194
 
195
195
  if (err) {
@@ -364,10 +364,10 @@ class Chat21Handler {
364
364
  // winston.warn("Chat21Sender this is a direct message. Unimplemented method", message);
365
365
 
366
366
  chat21.auth.setAdminToken(adminToken);
367
-
367
+
368
368
  // send: function(sender_fullname, recipient_id, recipient_fullname, text, sender_id, attributes, type, metadata){
369
369
  return chat21.messages.send(message.senderFullname, message.recipient,
370
- "recipient_fullname", message.text, message.sender, message.attributes, message.type, message.metadata)
370
+ message.recipientFullname, message.text, message.sender, message.attributes, message.type, message.metadata)
371
371
  .then(function(data){
372
372
  winston.verbose("Chat21Sender send sent: "+ JSON.stringify(data));
373
373
 
@@ -383,13 +383,54 @@ class Chat21Handler {
383
383
  });
384
384
 
385
385
  }).catch(function(err) {
386
- winston.error("Chat21 sendToGroup err", err);
386
+ winston.error("Chat21 send direct err", err);
387
387
  chat21Event.emit('message.sent.error', err);
388
388
  });
389
389
 
390
390
 
391
391
 
392
- } else {
392
+ }
393
+
394
+ else if (message &&
395
+ message.status === MessageConstants.CHAT_MESSAGE_STATUS.SENDING &&
396
+ message.channel_type == MessageConstants.CHANNEL_TYPE.GROUP &&
397
+ message.channel.name == ChannelConstants.CHAT21) {
398
+
399
+ // winston.warn("Chat21Sender this is a group message. Unimplemented method", message);
400
+
401
+ chat21.auth.setAdminToken(adminToken);
402
+
403
+ var timestamp = Date.now();
404
+ // var timestamp = undefined;
405
+ if (message.attributes && message.attributes.clienttimestamp) {
406
+ timestamp = message.attributes.clienttimestamp;
407
+ }
408
+
409
+
410
+ return chat21.messages.sendToGroup(message.senderFullname, message.recipient,
411
+ message.recipientFullname, message.text, message.sender, message.attributes, message.type, message.metadata, timestamp)
412
+ .then(function(data){
413
+ winston.verbose("Chat21Sender send sent: "+ JSON.stringify(data));
414
+
415
+
416
+ // chat21.conversations.stopTyping(message.recipient,message.sender);
417
+
418
+ chat21Event.emit('message.sent', data);
419
+
420
+ messageService.changeStatus(message._id, MessageConstants.CHAT_MESSAGE_STATUS.DELIVERED) .then(function(upMessage){
421
+ winston.debug("Chat21 message sent ", upMessage.toObject());
422
+ }).catch(function(err) {
423
+ winston.error("Error Chat21 message sent with id: "+message._id, err);
424
+ });
425
+
426
+ }).catch(function(err) {
427
+ winston.error("Chat21 sendToGroup err", err);
428
+ chat21Event.emit('message.sent.error', err);
429
+ });
430
+
431
+
432
+
433
+ } else {
393
434
  winston.error("Chat21Sender this is not a group o direct message", message);
394
435
  return;
395
436
  }
@@ -815,6 +856,8 @@ class Chat21Handler {
815
856
 
816
857
  return chat21.groups.create(group.name, groupMembers, undefined, group_id).then(function(data) {
817
858
  winston.verbose("Chat21 group created: " + JSON.stringify(data));
859
+ // TODO ritorna success anche se
860
+ // verbose: Chat21 group created: {"success":false,"err":{"message":"Channel closed","stack":"IllegalOperationError: Channel closed\n at ConfirmChannel.<anonymous> (/usr/src/app/node_modules/amqplib/lib/channel.js:160:11)\n at ConfirmChannel.Channel.publish (/usr/src/app/node_modules/amqplib/lib/callback_model.js:171:17)\n at ConfirmChannel.publish (/usr/src/app/node_modules/amqplib/lib/callback_model.js:301:36)\n at Chat21Api.publish (/usr/src/app/chat21Api/index.js:1028:29)\n at Chat21Api.sendMessageRaw (/usr/src/app/chat21Api/index.js:762:14)\n at Chat21Api.sendGroupWelcomeMessage (/usr/src/app/chat21Api/index.js:205:14)\n at /usr/src/app/chat21Api/index.js:99:22\n at /usr/src/app/chat21Api/index.js:234:17\n at /usr/src/app/chatdb/index.js:77:9\n at executeCallback (/usr/src/app/node_modules/mongodb/lib/operations/execute_operation.js:70:5)\n at updateCallback (/usr/src/app/node_modules/mongodb/lib/operations/update_one.js:41:3)\n at /usr/src/app/node_modules/mongodb/lib/operations/update_one.js:24:64\n at handleCallback (/usr/src/app/node_modules/mongodb/lib/utils.js:128:55)\n at /usr/src/app/node_modules/mongodb/lib/operations/common_functions.js:378:5\n at handler (/usr/src/app/node_modules/mongodb/lib/core/sdam/topology.js:913:24)","stackAtStateChange":"Stack capture: Socket error\n at Connection.C.onSocketError (/usr/src/app/node_modules/amqplib/lib/connection.js:354:13)\n at Connection.emit (events.js:314:20)\n at Socket.go (/usr/src/app/node_modules/amqplib/lib/connection.js:481:12)\n at Socket.emit (events.js:314:20)\n at emitReadable_ (_stream_readable.js:557:12)\n at processTicksAndRejections (internal/process/task_queues.js:83:21)"}}
818
861
  chat21Event.emit('group.create', data);
819
862
  }).catch(function(err) {
820
863
  winston.error("Error creating chat21 group ", err);