@webex/internal-plugin-conversation 3.7.0-next.1 → 3.7.0-next.3

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.
@@ -391,7 +391,7 @@ var ShareActivity = _webexCore.WebexPlugin.extend({
391
391
  return res.body.spaceUrl;
392
392
  });
393
393
  },
394
- version: "3.7.0-next.1"
394
+ version: "3.7.0-next.3"
395
395
  });
396
396
 
397
397
  /**
package/package.json CHANGED
@@ -19,12 +19,12 @@
19
19
  ]
20
20
  },
21
21
  "dependencies": {
22
- "@webex/common": "3.7.0-next.1",
23
- "@webex/helper-html": "3.7.0-next.1",
24
- "@webex/helper-image": "3.7.0-next.1",
25
- "@webex/internal-plugin-encryption": "3.7.0-next.1",
26
- "@webex/internal-plugin-user": "3.7.0-next.1",
27
- "@webex/webex-core": "3.7.0-next.1",
22
+ "@webex/common": "3.7.0-next.2",
23
+ "@webex/helper-html": "3.7.0-next.2",
24
+ "@webex/helper-image": "3.7.0-next.2",
25
+ "@webex/internal-plugin-encryption": "3.7.0-next.2",
26
+ "@webex/internal-plugin-user": "3.7.0-next.2",
27
+ "@webex/webex-core": "3.7.0-next.2",
28
28
  "crypto-js": "^4.1.1",
29
29
  "lodash": "^4.17.21",
30
30
  "node-scr": "^0.3.0",
@@ -36,13 +36,13 @@
36
36
  "@webex/eslint-config-legacy": "0.0.0",
37
37
  "@webex/jest-config-legacy": "0.0.0",
38
38
  "@webex/legacy-tools": "0.0.0",
39
- "@webex/test-helper-chai": "3.7.0-next.1",
40
- "@webex/test-helper-file": "3.7.0-next.1",
41
- "@webex/test-helper-make-local-url": "3.7.0-next.1",
42
- "@webex/test-helper-mocha": "3.7.0-next.1",
43
- "@webex/test-helper-mock-webex": "3.7.0-next.1",
44
- "@webex/test-helper-retry": "3.7.0-next.1",
45
- "@webex/test-helper-test-users": "3.7.0-next.1",
39
+ "@webex/test-helper-chai": "3.7.0-next.2",
40
+ "@webex/test-helper-file": "3.7.0-next.2",
41
+ "@webex/test-helper-make-local-url": "3.7.0-next.2",
42
+ "@webex/test-helper-mocha": "3.7.0-next.2",
43
+ "@webex/test-helper-mock-webex": "3.7.0-next.2",
44
+ "@webex/test-helper-retry": "3.7.0-next.2",
45
+ "@webex/test-helper-test-users": "3.7.0-next.2",
46
46
  "eslint": "^8.24.0",
47
47
  "prettier": "^2.7.1",
48
48
  "sinon": "^9.2.4"
@@ -56,5 +56,5 @@
56
56
  "test:style": "eslint ./src/**/*.*",
57
57
  "test:unit": "webex-legacy-tools test --unit --runner jest"
58
58
  },
59
- "version": "3.7.0-next.1"
59
+ "version": "3.7.0-next.3"
60
60
  }
@@ -340,33 +340,36 @@ const Conversation = WebexPlugin.extend({
340
340
  * @param {String} recipientId,
341
341
  * @returns {Promise<Activity>}
342
342
  */
343
- addReaction(conversation, displayName, activity, recipientId) {
344
- return this.createReactionHmac(displayName, activity).then((hmac) => {
345
- const addReactionPayload = {
346
- actor: {objectType: 'person', id: this.webex.internal.device.userId},
347
- target: {
348
- id: conversation.id,
349
- objectType: 'conversation',
350
- },
351
- verb: 'add',
352
- objectType: 'activity',
353
- parent: {
354
- type: 'reaction',
355
- id: activity.id,
356
- },
357
- object: {
358
- objectType: 'reaction2',
359
- displayName,
360
- hmac,
361
- },
362
- };
343
+ async addReaction(conversation, displayName, activity, recipientId) {
344
+ let hmac;
345
+ if (this.config.includeEncryptionTransforms) {
346
+ hmac = await this.createReactionHmac(displayName, activity);
347
+ }
363
348
 
364
- if (recipientId) {
365
- addReactionPayload.recipients = {items: [{id: recipientId, objectType: 'person'}]};
366
- }
349
+ const addReactionPayload = {
350
+ actor: {objectType: 'person', id: this.webex.internal.device.userId},
351
+ target: {
352
+ id: conversation.id,
353
+ objectType: 'conversation',
354
+ },
355
+ verb: 'add',
356
+ objectType: 'activity',
357
+ parent: {
358
+ type: 'reaction',
359
+ id: activity.id,
360
+ },
361
+ object: {
362
+ objectType: 'reaction2',
363
+ displayName,
364
+ hmac,
365
+ },
366
+ };
367
367
 
368
- return this.sendReaction(conversation, addReactionPayload);
369
- });
368
+ if (recipientId) {
369
+ addReactionPayload.recipients = {items: [{id: recipientId, objectType: 'person'}]};
370
+ }
371
+
372
+ return this.sendReaction(conversation, addReactionPayload);
370
373
  },
371
374
 
372
375
  /**
@@ -41,49 +41,27 @@ describe('plugin-conversation', () => {
41
41
  const {conversation} = webex.internal;
42
42
  const recipientId = 'example-recipient-id';
43
43
  const expected = {items: [{id: recipientId, objectType: 'person'}]};
44
+ conversation.config.includeEncryptionTransforms = true;
44
45
  conversation.sendReaction = sinon.stub().returns(Promise.resolve());
45
46
  conversation.createReactionHmac = sinon.stub().returns(Promise.resolve('hmac'));
46
47
 
47
48
  return conversation.addReaction({}, 'example-display-name', {}, recipientId).then(() => {
49
+ assert.called(conversation.createReactionHmac);
48
50
  assert.deepEqual(conversation.sendReaction.args[0][1].recipients, expected);
49
51
  });
50
52
  });
51
- });
52
-
53
- describe('deleteReaction()', () => {
54
- it('should add recipients to the payload if provided', () => {
55
- const {conversation} = webex.internal;
56
- const recipientId = 'example-recipient-id';
57
- const expected = {items: [{id: recipientId, objectType: 'person'}]};
58
- conversation.sendReaction = sinon.stub().returns(Promise.resolve());
59
-
60
- return conversation.deleteReaction({}, 'example-reaction-id', recipientId).then(() => {
61
- assert.deepEqual(conversation.sendReaction.args[0][1].recipients, expected);
62
- });
63
- });
64
- });
65
53
 
66
- describe('prepare()', () => {
67
- it('should ammend activity recipients to the returned object', () => {
68
- const {conversation} = webex.internal;
69
- const activity = {recipients: 'example-recipients'};
70
-
71
- return conversation.prepare(activity).then((results) => {
72
- assert.deepEqual(results.recipients, activity.recipients);
73
- });
74
- });
75
- });
76
-
77
- describe('addReaction()', () => {
78
- it('should add recipients to the payload if provided', () => {
54
+ it('will not call createReactionHmac if config prohibits', () => {
79
55
  const {conversation} = webex.internal;
80
56
  const recipientId = 'example-recipient-id';
81
57
  const expected = {items: [{id: recipientId, objectType: 'person'}]};
58
+ conversation.config.includeEncryptionTransforms = false;
82
59
  conversation.sendReaction = sinon.stub().returns(Promise.resolve());
83
- conversation.createReactionHmac = sinon.stub().returns(Promise.resolve('hmac'));
60
+ conversation.createReactionHmac = sinon.stub();
84
61
 
85
62
  return conversation.addReaction({}, 'example-display-name', {}, recipientId).then(() => {
86
63
  assert.deepEqual(conversation.sendReaction.args[0][1].recipients, expected);
64
+ assert.notCalled(conversation.createReactionHmac);
87
65
  });
88
66
  });
89
67
  });