@webex/plugin-memberships 3.0.0-beta.9 → 3.0.0-bnr.2
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/README.md +3 -6
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/memberships.js +20 -67
- package/dist/memberships.js.map +1 -1
- package/dist/plugin-memberships.d.ts +12 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/memberships.d.ts +50 -0
- package/package.json +12 -12
- package/src/memberships.js +100 -103
- package/test/integration/spec/memberships.js +360 -304
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export default Memberships;
|
|
2
|
+
export type MembershipObject = {
|
|
3
|
+
/**
|
|
4
|
+
* - Unique identifier for the membership
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* - The room ID
|
|
9
|
+
*/
|
|
10
|
+
roomId: string;
|
|
11
|
+
/**
|
|
12
|
+
* - The person ID
|
|
13
|
+
*/
|
|
14
|
+
personId: string;
|
|
15
|
+
/**
|
|
16
|
+
* - The email address of the person / room member
|
|
17
|
+
*/
|
|
18
|
+
personEmail: email;
|
|
19
|
+
/**
|
|
20
|
+
* - Indicates whether the specified person should be a room moderator
|
|
21
|
+
*/
|
|
22
|
+
isModerator: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* - Indicates whether the specified member is a room monitor
|
|
25
|
+
*/
|
|
26
|
+
isMonitor: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* - The date and time that this membership was created
|
|
29
|
+
*/
|
|
30
|
+
created: isoDate;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} MembershipObject
|
|
34
|
+
* @property {string} id - Unique identifier for the membership
|
|
35
|
+
* @property {string} roomId - The room ID
|
|
36
|
+
* @property {string} personId - The person ID
|
|
37
|
+
* @property {email} personEmail - The email address of the person / room member
|
|
38
|
+
* @property {boolean} isModerator - Indicates whether the specified person should be a room moderator
|
|
39
|
+
* @property {boolean} isMonitor - Indicates whether the specified member is a room monitor
|
|
40
|
+
* @property {isoDate} created - The date and time that this membership was created
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Memberships represent a person's relationship to a room. Use this API to list
|
|
44
|
+
* members of any room that you're in or create memberships to invite someone
|
|
45
|
+
* to a room. Memberships can also be updated to make someone a moderator
|
|
46
|
+
* or deleted to remove them from the room.
|
|
47
|
+
* @class
|
|
48
|
+
* @name Memberships
|
|
49
|
+
*/
|
|
50
|
+
declare const Memberships: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-memberships",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-bnr.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@webex/test-helper-chai": "3.0.0-
|
|
24
|
-
"@webex/test-helper-test-users": "3.0.0-
|
|
23
|
+
"@webex/test-helper-chai": "3.0.0-bnr.2",
|
|
24
|
+
"@webex/test-helper-test-users": "3.0.0-bnr.2",
|
|
25
25
|
"sinon": "^9.2.4"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@webex/common": "3.0.0-
|
|
29
|
-
"@webex/internal-plugin-conversation": "3.0.0-
|
|
30
|
-
"@webex/internal-plugin-mercury": "3.0.0-
|
|
31
|
-
"@webex/plugin-logger": "3.0.0-
|
|
32
|
-
"@webex/plugin-memberships": "3.0.0-
|
|
33
|
-
"@webex/plugin-messages": "3.0.0-
|
|
34
|
-
"@webex/plugin-people": "3.0.0-
|
|
35
|
-
"@webex/plugin-rooms": "3.0.0-
|
|
36
|
-
"@webex/webex-core": "3.0.0-
|
|
28
|
+
"@webex/common": "3.0.0-bnr.2",
|
|
29
|
+
"@webex/internal-plugin-conversation": "3.0.0-bnr.2",
|
|
30
|
+
"@webex/internal-plugin-mercury": "3.0.0-bnr.2",
|
|
31
|
+
"@webex/plugin-logger": "3.0.0-bnr.2",
|
|
32
|
+
"@webex/plugin-memberships": "3.0.0-bnr.2",
|
|
33
|
+
"@webex/plugin-messages": "3.0.0-bnr.2",
|
|
34
|
+
"@webex/plugin-people": "3.0.0-bnr.2",
|
|
35
|
+
"@webex/plugin-rooms": "3.0.0-bnr.2",
|
|
36
|
+
"@webex/webex-core": "3.0.0-bnr.2",
|
|
37
37
|
"debug": "^4.3.4",
|
|
38
38
|
"lodash": "^4.17.21"
|
|
39
39
|
}
|
package/src/memberships.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
buildHydraRoomId,
|
|
14
14
|
getHydraClusterString,
|
|
15
15
|
getHydraRoomType,
|
|
16
|
-
deconstructHydraId
|
|
16
|
+
deconstructHydraId,
|
|
17
17
|
} from '@webex/common';
|
|
18
18
|
import {WebexPlugin, Page} from '@webex/webex-core';
|
|
19
19
|
import {cloneDeep} from 'lodash';
|
|
@@ -86,18 +86,18 @@ const Memberships = WebexPlugin.extend({
|
|
|
86
86
|
*/
|
|
87
87
|
listen() {
|
|
88
88
|
// Create a common envelope that we will wrap all events in
|
|
89
|
-
return createEventEnvelope(this.webex,
|
|
90
|
-
|
|
91
|
-
.then((envelope) => {
|
|
89
|
+
return createEventEnvelope(this.webex, SDK_EVENT.EXTERNAL.RESOURCE.MEMBERSHIPS).then(
|
|
90
|
+
(envelope) => {
|
|
92
91
|
this.eventEnvelope = envelope;
|
|
93
92
|
|
|
94
93
|
// Register to listen to events
|
|
95
94
|
return this.webex.internal.mercury.connect().then(() => {
|
|
96
|
-
this.listenTo(this.webex.internal.mercury,
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
this.listenTo(this.webex.internal.mercury, SDK_EVENT.INTERNAL.WEBEX_ACTIVITY, (event) =>
|
|
96
|
+
this.onWebexApiEvent(event)
|
|
97
|
+
);
|
|
99
98
|
});
|
|
100
|
-
}
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
101
|
},
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -134,9 +134,8 @@ const Memberships = WebexPlugin.extend({
|
|
|
134
134
|
method: 'POST',
|
|
135
135
|
service: 'hydra',
|
|
136
136
|
resource: 'memberships',
|
|
137
|
-
body: membership
|
|
138
|
-
})
|
|
139
|
-
.then((res) => res.body);
|
|
137
|
+
body: membership,
|
|
138
|
+
}).then((res) => res.body);
|
|
140
139
|
},
|
|
141
140
|
|
|
142
141
|
/**
|
|
@@ -170,9 +169,8 @@ const Memberships = WebexPlugin.extend({
|
|
|
170
169
|
|
|
171
170
|
return this.request({
|
|
172
171
|
service: 'hydra',
|
|
173
|
-
resource: `memberships/${id}
|
|
174
|
-
})
|
|
175
|
-
.then((res) => res.body.items || res.body);
|
|
172
|
+
resource: `memberships/${id}`,
|
|
173
|
+
}).then((res) => res.body.items || res.body);
|
|
176
174
|
},
|
|
177
175
|
|
|
178
176
|
/**
|
|
@@ -215,9 +213,8 @@ const Memberships = WebexPlugin.extend({
|
|
|
215
213
|
return this.request({
|
|
216
214
|
service: 'hydra',
|
|
217
215
|
resource: 'memberships',
|
|
218
|
-
qs: options
|
|
219
|
-
})
|
|
220
|
-
.then((res) => new Page(res, this.webex));
|
|
216
|
+
qs: options,
|
|
217
|
+
}).then((res) => new Page(res, this.webex));
|
|
221
218
|
},
|
|
222
219
|
|
|
223
220
|
/**
|
|
@@ -251,15 +248,15 @@ const Memberships = WebexPlugin.extend({
|
|
|
251
248
|
const deconstructedId = deconstructHydraId(options.roomId);
|
|
252
249
|
const conversation = {
|
|
253
250
|
id: deconstructedId.id,
|
|
254
|
-
cluster: deconstructedId.cluster
|
|
251
|
+
cluster: deconstructedId.cluster,
|
|
255
252
|
};
|
|
256
253
|
|
|
257
|
-
return ensureMyIdIsAvailable(this.webex)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
{
|
|
254
|
+
return ensureMyIdIsAvailable(this.webex).then(() =>
|
|
255
|
+
this.webex.internal.services.waitForCatalog('postauth').then(() =>
|
|
256
|
+
this.webex.internal.conversation
|
|
257
|
+
.get(conversation, {
|
|
261
258
|
participantAckFilter: 'all', // show lastAck info for each participant
|
|
262
|
-
activitiesLimit: 0 // don't send the whole history of activity
|
|
259
|
+
activitiesLimit: 0, // don't send the whole history of activity
|
|
263
260
|
})
|
|
264
261
|
.then((resp) => {
|
|
265
262
|
try {
|
|
@@ -275,31 +272,28 @@ const Memberships = WebexPlugin.extend({
|
|
|
275
272
|
for (let i = 0; i < participants.length; i += 1) {
|
|
276
273
|
const participant = participants[i];
|
|
277
274
|
const participantInfo = {
|
|
278
|
-
id: buildHydraMembershipId(participant.entryUUID, roomUUID,
|
|
279
|
-
conversation.cluster),
|
|
275
|
+
id: buildHydraMembershipId(participant.entryUUID, roomUUID, conversation.cluster),
|
|
280
276
|
roomId,
|
|
281
277
|
personId: buildHydraPersonId(participant.entryUUID),
|
|
282
|
-
personEmail: participant.entryEmailAddress ||
|
|
283
|
-
participant.entryEmail,
|
|
278
|
+
personEmail: participant.entryEmailAddress || participant.entryEmail,
|
|
284
279
|
personDisplayName: participant.displayName,
|
|
285
|
-
personOrgId: buildHydraOrgId(participant.orgId,
|
|
286
|
-
conversation.cluster),
|
|
280
|
+
personOrgId: buildHydraOrgId(participant.orgId, conversation.cluster),
|
|
287
281
|
isMonitor: false, // deprecated, but included for completeness
|
|
288
|
-
roomType
|
|
282
|
+
roomType,
|
|
289
283
|
// created is not available in the conversations payload
|
|
290
284
|
};
|
|
291
285
|
|
|
292
|
-
if (
|
|
286
|
+
if (isRoomHidden && participantInfo.personId === myId) {
|
|
293
287
|
participantInfo.isRoomHidden = isRoomHidden;
|
|
294
288
|
}
|
|
295
289
|
|
|
296
290
|
if ('roomProperties' in participant) {
|
|
297
291
|
if ('lastSeenActivityDate' in participant.roomProperties) {
|
|
298
|
-
participantInfo.lastSeenId =
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
292
|
+
participantInfo.lastSeenId = buildHydraMessageId(
|
|
293
|
+
participant.roomProperties.lastSeenActivityUUID,
|
|
294
|
+
conversation.cluster
|
|
295
|
+
);
|
|
296
|
+
participantInfo.lastSeenDate = participant.roomProperties.lastSeenActivityDate;
|
|
303
297
|
}
|
|
304
298
|
if ('isModerator' in participant.roomProperties) {
|
|
305
299
|
participantInfo.isModerator = participant.roomProperties.isModerator;
|
|
@@ -310,11 +304,12 @@ const Memberships = WebexPlugin.extend({
|
|
|
310
304
|
}
|
|
311
305
|
|
|
312
306
|
return Promise.resolve(lastReadInfo);
|
|
313
|
-
}
|
|
314
|
-
catch (e) {
|
|
307
|
+
} catch (e) {
|
|
315
308
|
return Promise.reject(e);
|
|
316
309
|
}
|
|
317
|
-
})
|
|
310
|
+
})
|
|
311
|
+
)
|
|
312
|
+
);
|
|
318
313
|
},
|
|
319
314
|
|
|
320
315
|
/**
|
|
@@ -358,17 +353,16 @@ const Memberships = WebexPlugin.extend({
|
|
|
358
353
|
return this.request({
|
|
359
354
|
method: 'DELETE',
|
|
360
355
|
service: 'hydra',
|
|
361
|
-
resource: `memberships/${id}
|
|
362
|
-
})
|
|
363
|
-
.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
356
|
+
resource: `memberships/${id}`,
|
|
357
|
+
}).then((res) => {
|
|
358
|
+
// Firefox has some issues with 204s and/or DELETE. This should move to
|
|
359
|
+
// http-core
|
|
360
|
+
if (res.statusCode === 204) {
|
|
361
|
+
return undefined;
|
|
362
|
+
}
|
|
369
363
|
|
|
370
|
-
|
|
371
|
-
|
|
364
|
+
return res.body;
|
|
365
|
+
});
|
|
372
366
|
},
|
|
373
367
|
|
|
374
368
|
/**
|
|
@@ -440,9 +434,8 @@ const Memberships = WebexPlugin.extend({
|
|
|
440
434
|
method: 'PUT',
|
|
441
435
|
service: 'hydra',
|
|
442
436
|
resource: `memberships/${id}`,
|
|
443
|
-
body: membership
|
|
444
|
-
})
|
|
445
|
-
.then((res) => res.body);
|
|
437
|
+
body: membership,
|
|
438
|
+
}).then((res) => res.body);
|
|
446
439
|
},
|
|
447
440
|
|
|
448
441
|
/**
|
|
@@ -457,30 +450,29 @@ const Memberships = WebexPlugin.extend({
|
|
|
457
450
|
*/
|
|
458
451
|
updateLastSeen(message) {
|
|
459
452
|
const activity = {
|
|
460
|
-
id: deconstructHydraId(message.id).id
|
|
453
|
+
id: deconstructHydraId(message.id).id,
|
|
461
454
|
};
|
|
462
455
|
const deconstructedId = deconstructHydraId(message.roomId);
|
|
463
456
|
const conversation = {
|
|
464
457
|
id: deconstructedId.id,
|
|
465
|
-
cluster: deconstructedId.cluster
|
|
458
|
+
cluster: deconstructedId.cluster,
|
|
466
459
|
};
|
|
467
460
|
|
|
468
|
-
return this.webex.internal.services.waitForCatalog('postauth')
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
})));
|
|
461
|
+
return this.webex.internal.services.waitForCatalog('postauth').then(() =>
|
|
462
|
+
this.webex.internal.conversation.acknowledge(conversation, activity).then((ack) => ({
|
|
463
|
+
lastSeenId: buildHydraMessageId(ack.object.id, conversation.cluster),
|
|
464
|
+
id: buildHydraMembershipId(ack.actor.entryUUID, ack.target.id, conversation.cluster),
|
|
465
|
+
personId: buildHydraPersonId(ack.actor.entryUUID, conversation.cluster),
|
|
466
|
+
personEmail: ack.actor.emailAddress || ack.actor.entryEmail,
|
|
467
|
+
personDisplayName: ack.actor.displayName,
|
|
468
|
+
personOrgId: buildHydraOrgId(ack.actor.orgId, conversation.cluster),
|
|
469
|
+
roomId: buildHydraRoomId(ack.target.id, conversation.cluster),
|
|
470
|
+
roomType: getHydraRoomType(ack.target.tags),
|
|
471
|
+
isRoomHidden: false, // any activity unhides a space.
|
|
472
|
+
isMonitor: false, // deprecated, returned for back compat
|
|
473
|
+
created: ack.published,
|
|
474
|
+
}))
|
|
475
|
+
);
|
|
484
476
|
},
|
|
485
477
|
|
|
486
478
|
/**
|
|
@@ -498,16 +490,16 @@ const Memberships = WebexPlugin.extend({
|
|
|
498
490
|
/* eslint-disable no-case-declarations */
|
|
499
491
|
switch (activity.verb) {
|
|
500
492
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.CREATE:
|
|
501
|
-
const membershipCreatedEventDataArray =
|
|
502
|
-
|
|
493
|
+
const membershipCreatedEventDataArray = activity.object.participants.items.map(
|
|
494
|
+
(participant) => {
|
|
503
495
|
const output = cloneDeep(activity);
|
|
504
496
|
|
|
505
497
|
output.target = cloneDeep(activity.object);
|
|
506
498
|
output.object = cloneDeep(participant);
|
|
507
499
|
|
|
508
|
-
return this.getMembershipEvent(output,
|
|
509
|
-
|
|
510
|
-
|
|
500
|
+
return this.getMembershipEvent(output, SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED);
|
|
501
|
+
}
|
|
502
|
+
);
|
|
511
503
|
|
|
512
504
|
membershipCreatedEventDataArray.forEach((data) => {
|
|
513
505
|
if (data) {
|
|
@@ -518,8 +510,10 @@ const Memberships = WebexPlugin.extend({
|
|
|
518
510
|
break;
|
|
519
511
|
|
|
520
512
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.ADD:
|
|
521
|
-
const membershipCreatedEventData =
|
|
522
|
-
|
|
513
|
+
const membershipCreatedEventData = this.getMembershipEvent(
|
|
514
|
+
activity,
|
|
515
|
+
SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED
|
|
516
|
+
);
|
|
523
517
|
|
|
524
518
|
if (membershipCreatedEventData) {
|
|
525
519
|
debug(`membership "created" payload: \
|
|
@@ -529,8 +523,10 @@ const Memberships = WebexPlugin.extend({
|
|
|
529
523
|
break;
|
|
530
524
|
|
|
531
525
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.LEAVE:
|
|
532
|
-
const membershipDeletedEventData =
|
|
533
|
-
|
|
526
|
+
const membershipDeletedEventData = this.getMembershipEvent(
|
|
527
|
+
activity,
|
|
528
|
+
SDK_EVENT.EXTERNAL.EVENT_TYPE.DELETED
|
|
529
|
+
);
|
|
534
530
|
|
|
535
531
|
if (membershipDeletedEventData) {
|
|
536
532
|
debug(`membership "deleted" payload: \
|
|
@@ -542,8 +538,10 @@ const Memberships = WebexPlugin.extend({
|
|
|
542
538
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.ADD_MODERATOR:
|
|
543
539
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.REMOVE_MODERATOR:
|
|
544
540
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.HIDE:
|
|
545
|
-
const membershipUpdatedEventData =
|
|
546
|
-
|
|
541
|
+
const membershipUpdatedEventData = this.getMembershipEvent(
|
|
542
|
+
activity,
|
|
543
|
+
SDK_EVENT.EXTERNAL.EVENT_TYPE.UPDATED
|
|
544
|
+
);
|
|
547
545
|
|
|
548
546
|
if (membershipUpdatedEventData) {
|
|
549
547
|
debug(`membership "updated" payload: \
|
|
@@ -553,8 +551,10 @@ const Memberships = WebexPlugin.extend({
|
|
|
553
551
|
break;
|
|
554
552
|
|
|
555
553
|
case SDK_EVENT.INTERNAL.ACTIVITY_VERB.ACKNOWLEDGE:
|
|
556
|
-
const membershipSeenEventData =
|
|
557
|
-
|
|
554
|
+
const membershipSeenEventData = this.getMembershipEvent(
|
|
555
|
+
activity,
|
|
556
|
+
SDK_EVENT.EXTERNAL.EVENT_TYPE.SEEN
|
|
557
|
+
);
|
|
558
558
|
|
|
559
559
|
if (membershipSeenEventData) {
|
|
560
560
|
debug(`membership "updated" payload: \
|
|
@@ -581,9 +581,10 @@ const Memberships = WebexPlugin.extend({
|
|
|
581
581
|
getMembershipEvent(activity, event) {
|
|
582
582
|
try {
|
|
583
583
|
const sdkEvent = cloneDeep(this.eventEnvelope);
|
|
584
|
-
const cluster =
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
const cluster =
|
|
585
|
+
activity.verb !== SDK_EVENT.INTERNAL.ACTIVITY_VERB.HIDE
|
|
586
|
+
? getHydraClusterString(this.webex, activity.target.url)
|
|
587
|
+
: getHydraClusterString(this.webex, activity.url);
|
|
587
588
|
let member;
|
|
588
589
|
let space;
|
|
589
590
|
|
|
@@ -594,18 +595,16 @@ const Memberships = WebexPlugin.extend({
|
|
|
594
595
|
sdkEvent.data.roomId = buildHydraRoomId(activity.target.id, cluster);
|
|
595
596
|
sdkEvent.data.roomType = getHydraRoomType(activity.target.tags);
|
|
596
597
|
sdkEvent.data.isRoomHidden = false; // any activity unhides a space.
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
598
|
+
} else {
|
|
599
599
|
sdkEvent.data.roomId = buildHydraRoomId(activity.object.id, cluster);
|
|
600
600
|
sdkEvent.data.roomType = SDK_EVENT.EXTERNAL.SPACE_TYPE.DIRECT;
|
|
601
601
|
// currently hidden attribute is only set on 1-1
|
|
602
602
|
sdkEvent.data.isRoomHidden = true;
|
|
603
603
|
}
|
|
604
604
|
if (activity.verb !== SDK_EVENT.INTERNAL.ACTIVITY_VERB.ACKNOWLEDGE) {
|
|
605
|
-
if (
|
|
605
|
+
if (activity.object.roomProperties && activity.object.roomProperties.isModerator) {
|
|
606
606
|
sdkEvent.data.isModerator = true;
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
607
|
+
} else {
|
|
609
608
|
sdkEvent.data.isModerator = false;
|
|
610
609
|
}
|
|
611
610
|
}
|
|
@@ -620,38 +619,36 @@ const Memberships = WebexPlugin.extend({
|
|
|
620
619
|
space = SDK_EVENT.INTERNAL.ACTIVITY_FIELD.TARGET;
|
|
621
620
|
// And the "object" is the message that was last seen
|
|
622
621
|
sdkEvent.data.lastSeenId = buildHydraMessageId(activity.object.id, cluster);
|
|
623
|
-
}
|
|
624
|
-
else if (activity.verb === SDK_EVENT.INTERNAL.ACTIVITY_VERB.HIDE) {
|
|
622
|
+
} else if (activity.verb === SDK_EVENT.INTERNAL.ACTIVITY_VERB.HIDE) {
|
|
625
623
|
// For a hide activity the person is also the "actor"
|
|
626
624
|
member = SDK_EVENT.INTERNAL.ACTIVITY_FIELD.ACTOR;
|
|
627
625
|
// But the space is now the "object"
|
|
628
626
|
space = SDK_EVENT.INTERNAL.ACTIVITY_FIELD.OBJECT;
|
|
629
|
-
}
|
|
630
|
-
else {
|
|
627
|
+
} else {
|
|
631
628
|
// For most memberships events the person is the 'object"
|
|
632
629
|
member = SDK_EVENT.INTERNAL.ACTIVITY_FIELD.OBJECT;
|
|
633
630
|
// and the space is the "target"
|
|
634
631
|
space = SDK_EVENT.INTERNAL.ACTIVITY_FIELD.TARGET;
|
|
635
632
|
}
|
|
636
633
|
|
|
637
|
-
sdkEvent.data.id = buildHydraMembershipId(
|
|
638
|
-
activity[
|
|
634
|
+
sdkEvent.data.id = buildHydraMembershipId(
|
|
635
|
+
activity[member].entryUUID,
|
|
636
|
+
activity[space].id,
|
|
637
|
+
cluster
|
|
638
|
+
);
|
|
639
639
|
sdkEvent.data.personId = buildHydraPersonId(activity[member].entryUUID, cluster);
|
|
640
|
-
sdkEvent.data.personEmail =
|
|
641
|
-
activity[member].emailAddress || activity[member].entryEmail;
|
|
640
|
+
sdkEvent.data.personEmail = activity[member].emailAddress || activity[member].entryEmail;
|
|
642
641
|
sdkEvent.data.personDisplayName = activity[member].displayName;
|
|
643
642
|
sdkEvent.data.personOrgId = buildHydraOrgId(activity[member].orgId, cluster);
|
|
644
643
|
|
|
645
644
|
return sdkEvent;
|
|
646
|
-
}
|
|
647
|
-
catch (e) {
|
|
645
|
+
} catch (e) {
|
|
648
646
|
this.webex.logger.error(`Unable to generate SDK event from mercury \
|
|
649
647
|
'socket activity for memberships:${event} event: ${e.message}`);
|
|
650
648
|
|
|
651
649
|
return null;
|
|
652
650
|
}
|
|
653
|
-
}
|
|
654
|
-
|
|
651
|
+
},
|
|
655
652
|
});
|
|
656
653
|
|
|
657
654
|
export default Memberships;
|