@webex/internal-plugin-conversation 3.0.0-beta.15 → 3.0.0-beta.151
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/dist/activities.js +8 -69
- package/dist/activities.js.map +1 -1
- package/dist/activity-thread-ordering.js +19 -79
- package/dist/activity-thread-ordering.js.map +1 -1
- package/dist/config.js +0 -6
- package/dist/config.js.map +1 -1
- package/dist/constants.js +4 -5
- package/dist/constants.js.map +1 -1
- package/dist/conversation.js +741 -1167
- package/dist/conversation.js.map +1 -1
- package/dist/convo-error.js +0 -23
- package/dist/convo-error.js.map +1 -1
- package/dist/decryption-transforms.js +11 -74
- package/dist/decryption-transforms.js.map +1 -1
- package/dist/encryption-transforms.js +10 -47
- package/dist/encryption-transforms.js.map +1 -1
- package/dist/index.js +7 -50
- package/dist/index.js.map +1 -1
- package/dist/share-activity.js +25 -105
- package/dist/share-activity.js.map +1 -1
- package/dist/to-array.js +0 -16
- package/dist/to-array.js.map +1 -1
- package/package.json +15 -15
- package/src/conversation.js +18 -3
- package/src/share-activity.js +1 -1
- package/test/integration/spec/create.js +2 -3
- package/test/integration/spec/encryption.js +0 -1
- package/test/integration/spec/get.js +3 -2
- package/test/unit/spec/conversation.js +41 -0
package/src/conversation.js
CHANGED
|
@@ -309,10 +309,11 @@ const Conversation = WebexPlugin.extend({
|
|
|
309
309
|
/**
|
|
310
310
|
* delete a reaction
|
|
311
311
|
* @param {Object} conversation
|
|
312
|
-
* @param {Object} reactionId
|
|
312
|
+
* @param {Object} reactionId,
|
|
313
|
+
* @param {String} recipientId,
|
|
313
314
|
* @returns {Promise<Activity>}
|
|
314
315
|
*/
|
|
315
|
-
deleteReaction(conversation, reactionId) {
|
|
316
|
+
deleteReaction(conversation, reactionId, recipientId) {
|
|
316
317
|
const deleteReactionPayload = {
|
|
317
318
|
actor: {objectType: 'person', id: this.webex.internal.device.userId},
|
|
318
319
|
object: {
|
|
@@ -327,6 +328,11 @@ const Conversation = WebexPlugin.extend({
|
|
|
327
328
|
verb: 'delete',
|
|
328
329
|
};
|
|
329
330
|
|
|
331
|
+
// Is not required for the request to be accepted, but follows specification.
|
|
332
|
+
if (recipientId) {
|
|
333
|
+
deleteReactionPayload.recipients = {items: [{id: recipientId, objectType: 'person'}]};
|
|
334
|
+
}
|
|
335
|
+
|
|
330
336
|
return this.sendReaction(conversation, deleteReactionPayload);
|
|
331
337
|
},
|
|
332
338
|
|
|
@@ -335,9 +341,10 @@ const Conversation = WebexPlugin.extend({
|
|
|
335
341
|
* @param {Object} conversation
|
|
336
342
|
* @param {Object} displayName must be 'celebrate', 'heart', 'thumbsup', 'smiley', 'haha', 'confused', 'sad'
|
|
337
343
|
* @param {Object} activity activity object from convo we are reacting to
|
|
344
|
+
* @param {String} recipientId,
|
|
338
345
|
* @returns {Promise<Activity>}
|
|
339
346
|
*/
|
|
340
|
-
addReaction(conversation, displayName, activity) {
|
|
347
|
+
addReaction(conversation, displayName, activity, recipientId) {
|
|
341
348
|
return this.createReactionHmac(displayName, activity).then((hmac) => {
|
|
342
349
|
const addReactionPayload = {
|
|
343
350
|
actor: {objectType: 'person', id: this.webex.internal.device.userId},
|
|
@@ -358,6 +365,10 @@ const Conversation = WebexPlugin.extend({
|
|
|
358
365
|
},
|
|
359
366
|
};
|
|
360
367
|
|
|
368
|
+
if (recipientId) {
|
|
369
|
+
addReactionPayload.recipients = {items: [{id: recipientId, objectType: 'person'}]};
|
|
370
|
+
}
|
|
371
|
+
|
|
361
372
|
return this.sendReaction(conversation, addReactionPayload);
|
|
362
373
|
});
|
|
363
374
|
},
|
|
@@ -1053,6 +1064,10 @@ const Conversation = WebexPlugin.extend({
|
|
|
1053
1064
|
};
|
|
1054
1065
|
}
|
|
1055
1066
|
|
|
1067
|
+
if (activity.recipients) {
|
|
1068
|
+
act.recipients = activity.recipients;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1056
1071
|
if (isString(act.actor)) {
|
|
1057
1072
|
act.actor = {
|
|
1058
1073
|
objectType: 'person',
|
package/src/share-activity.js
CHANGED
|
@@ -156,7 +156,7 @@ const ShareActivity = WebexPlugin.extend({
|
|
|
156
156
|
*/
|
|
157
157
|
add(file, options) {
|
|
158
158
|
options = options || {};
|
|
159
|
-
options.claimedFileType = file.
|
|
159
|
+
options.claimedFileType = file.name.substring(file.name.lastIndexOf('.'));
|
|
160
160
|
let upload = this.uploads.get(file);
|
|
161
161
|
|
|
162
162
|
if (upload) {
|
|
@@ -43,7 +43,6 @@ describe('plugin-conversation', function () {
|
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
// eslint-disable-next-line no-unused-expressions
|
|
47
46
|
await webex.internal.mercury.connect();
|
|
48
47
|
await mccoy.webex.internal.mercury.connect();
|
|
49
48
|
|
|
@@ -51,9 +50,9 @@ describe('plugin-conversation', function () {
|
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
after(async () => {
|
|
54
|
-
// eslint-disable-next-line no-unused-expressions
|
|
53
|
+
// eslint-disable-next-line chai-friendly/no-unused-expressions
|
|
55
54
|
webex && (await webex.internal.mercury.disconnect());
|
|
56
|
-
// eslint-disable-next-line no-unused-expressions
|
|
55
|
+
// eslint-disable-next-line chai-friendly/no-unused-expressions
|
|
57
56
|
mccoy && (await mccoy.webex.internal.mercury.disconnect());
|
|
58
57
|
});
|
|
59
58
|
|
|
@@ -467,7 +467,8 @@ describe('plugin-conversation', function () {
|
|
|
467
467
|
}));
|
|
468
468
|
});
|
|
469
469
|
|
|
470
|
-
|
|
470
|
+
// SPARK-413317
|
|
471
|
+
describe.skip('with conversation from remote clusters', () => {
|
|
471
472
|
let conversation3, conversation4;
|
|
472
473
|
|
|
473
474
|
before('create conversations in EU cluster', () =>
|
|
@@ -959,7 +960,7 @@ describe('plugin-conversation', function () {
|
|
|
959
960
|
.then(({edit}) => {
|
|
960
961
|
assert.include(edit, parent.id);
|
|
961
962
|
}));
|
|
962
|
-
|
|
963
|
+
|
|
963
964
|
it('retrieves parent IDs for reactions', () =>
|
|
964
965
|
webex.internal.conversation
|
|
965
966
|
.addReaction(conversation, 'heart', parent)
|
|
@@ -35,6 +35,47 @@ describe('plugin-conversation', () => {
|
|
|
35
35
|
webex.internal.services.getServiceFromClusterId = sinon.stub().returns({url: convoUrl});
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
+
describe('addReaction()', () => {
|
|
39
|
+
it('should add recipients to the payload if provided', () => {
|
|
40
|
+
const {conversation} = webex.internal;
|
|
41
|
+
const recipientId = 'example-recipient-id';
|
|
42
|
+
const expected = {items: [{id: recipientId, objectType: 'person'}]}
|
|
43
|
+
conversation.sendReaction = sinon.stub().returns(Promise.resolve())
|
|
44
|
+
conversation.createReactionHmac = sinon.stub().returns(Promise.resolve('hmac'))
|
|
45
|
+
|
|
46
|
+
return conversation.addReaction({}, 'example-display-name', {}, recipientId)
|
|
47
|
+
.then(() => {
|
|
48
|
+
assert.deepEqual(conversation.sendReaction.args[0][1].recipients, expected);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
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)
|
|
61
|
+
.then(() => {
|
|
62
|
+
assert.deepEqual(conversation.sendReaction.args[0][1].recipients, expected);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('prepare()', () => {
|
|
68
|
+
it('should ammend activity recipients to the returned object', () => {
|
|
69
|
+
const {conversation} = webex.internal;
|
|
70
|
+
const activity = { recipients: 'example-recipients' };
|
|
71
|
+
|
|
72
|
+
return conversation.prepare(activity)
|
|
73
|
+
.then((results) => {
|
|
74
|
+
assert.deepEqual(results.recipients, activity.recipients);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
38
79
|
describe('processInmeetingchatEvent()', () => {
|
|
39
80
|
beforeEach(() => {
|
|
40
81
|
webex.transform = sinon.stub().callsFake((obj) => Promise.resolve(obj));
|