Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin-meetins: add adhoc meetings support #2309

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

arun3528
Copy link
Collaborator

@arun3528 arun3528 commented Mar 31, 2022

COMPLETES https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-290078

This pull request addresses

All the new adhoc webex meetings will use the new instantspace api for there webex meetings

As part of the api we need to fetch the conversation then make a api call to instant-space with the invite

by making the following changes

use the Following api for instant meetings
https://confluence-eng-gpk2.cisco.com/conf/display/WMT/WebexAppAPI+API+Document

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios where tested

Did manual testing to join a adhoc meeting and also checked if the obtp is being received

I certified that

  • I have read and followed contributing guidelines

  • I discussed changes with code owners prior to submitting this pull request

  • I have not skipped any automated checks

  • All existing and new tests passed

  • I have updated the documentation accordingly


Make sure to have followed the contributing guidelines before submitting.

@arun3528 arun3528 requested review from a team as code owners March 31, 2022 01:51
@arun3528 arun3528 force-pushed the adhoc-meeting branch 4 times, most recently from dbf086d to e347309 Compare April 4, 2022 13:48
@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2309.d3m3l2kee0btzx.amplifyapp.com

* @public
* @memberof MeetingInfo
*/
async createAdocSpaceMeeting(conversationUrl) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is one typo mistake here. The function name should be createAdhocSpaceMeeting.

invitees: getInvitees(conversation.participants?.items)
};

const uri = this.webex.meetings.preferedWebexSite ?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a temp workaround, right? do we have a jira for doing this properly? Also when we don't have preferedWebexSite then uri is empty and we still call this.webex.request with empty url

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not temp as for all the adhoc meetings we need to use the preferred webex site , For other meetings there is a JIRA to use the webex meeting domain to select the url

I will add an error object if preferred webex site it not found

@@ -368,6 +367,7 @@ export default class Meetings extends WebexPlugin {
onReady() {
this.webex.once(READY, () => {
StaticConfig.set(this.config);
LoggerProxy.set(this.webex.logger);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity: why do we need this change? and will that cause any issues with logging before onReady is called?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its from another PR , which i had rebased to fix test . should not be there now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have removed it for now , Previously wanted to fix it here

Team will work on it separately , Wont be able to merge this PR unless the other one is done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this other PR? Is there a jira?

@@ -605,6 +606,20 @@ export default class Meetings extends WebexPlugin {
});
}

/**
* Fetch user prefered webex site information
* This also have other infomation about the user
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have -> has

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infomation -> information

* @private
* @memberof Meetings
*/
fetchUserPreferedWebexSite() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Prefered -> Preferred

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

*/
fetchUserPreferedWebexSite() {
return this.request.fetchLoginUserInfomation().then((res) => {
this.preferedWebexSite = MeetingsUtil.parsePreferedWebexSite(res.userPreferences);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parsePreferedWebexSite name seems wrong as the function is parsing user preferences so should be named parseUserPreferences, shouldn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

MeetingsUtil.parsePreferedWebexSite = (userPreferences) => {
let webexSite = null;

userPreferences.find((site) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

site seems like a wrong name, we're iterating over userPreferences so the individual item in the array is a "userPreference" or something like that (or you could use a more generic name like "item" but for sure some of these are not going to be a site, so "site" is a wrong name to use here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

let webexSite = null;

userPreferences.find((site) => {
const preferedSite = site.match(/"preferredWebExSite":"(\S+)"/);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a shame that we have to be doing this kind of parsing. Why are they not returning proper json objects in the array? Should we maybe allow for whitespaces around the ":" character and also use the beginning of the string anchor, so it would be like this:
match(/^"preferredWebExSite"\s*:\s*"(\S+)"/)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i checked with the native client and thats how it is currently which i really hate , No other option

changed the regex

userPreferences.find((site) => {
const preferedSite = site.match(/"preferredWebExSite":"(\S+)"/);

if (preferedSite) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefered -> preferred


await meetingInfo.fetchMeetingInfo('conversationUrl', _CONVERSATION_URL_);

assert.calledWith(meetingInfo.createAdocSpaceMeeting, 'conversationUrl');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth also asserting that the normal meeting info api request is not sent

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@@ -98,6 +126,15 @@ describe('plugin-meetings', () => {
});
});

it('create adoc meeting when conversationUrl passed with enableAdhocMeetings toggle', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adoc -> adhoc

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -98,6 +126,15 @@ describe('plugin-meetings', () => {
});
});

it('create adoc meeting when conversationUrl passed with enableAdhocMeetings toggle', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a test for the case when enableAdhocMeetings toggle is disabled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

});

it('has a webex instance with a meetings property', () => {
assert.exists(webex, 'webex was initialized with children');
assert.exists(webex.meetings, 'meetings child was set up on the webex instance');
});

it('has set up the static config copy', () => {
xit('has set up the static config copy', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we skipping this and the next test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different issue , I cannot run the test file unless i comment them out

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I'm confused, are these tests currently running and passing on master or not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not passing in master as well . The testes were broken . have removed it for now

@@ -313,7 +340,7 @@ skipInBrowser(describe)('plugin-meetings', () => {
assert.calledWith(initialSetup, {url: url1});
});
});
describe('destory non active meeting', () => {
xdescribe('destory non active meeting', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are all these things disabled? (multiple xdescribe in this file)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were never running in the firs place so have asked the team to fix it , which will take some time

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a jira for that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neeraj-swarnkar is actively working on it

@@ -89,7 +89,8 @@ export default {
enableExtmap: false,
experimental: {
enableMediaNegotiatedEvent: false,
enableUnifiedMeetings: false
enableUnifiedMeetings: true,
enableAdhocMeetings: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we will need a function equivalent to _toggleUnifiedMeetings() for this new setting as the web app will need to set it based on feature toggles. Can you add it? It should be simpler - it only needs to change the config value and nothing else

@@ -64,6 +64,23 @@ MeetingsUtil.checkForCorrelationId = (deviceUrl, locus) => {
return false;
};

MeetingsUtil.parsePreferedWebexSite = (userPreferences) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parsePreferedWebexSite can be changed to parsePreferredWebexSite

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* fetch login user infomation
* @returns {Promise<object>} geoHintInfo
*/
fetchLoginUserInfomation() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetchLoginUserInfomation can be changed to fetchLoginUserInformation, I feel this is a typo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't both the same one can you re check it once

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're missing "r" in Information

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@arun3528 arun3528 force-pushed the adhoc-meeting branch 3 times, most recently from 20915f3 to 2249cb5 Compare April 7, 2022 03:15
@@ -192,8 +192,7 @@
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have changes in package-lock.json in this PR if there are no changes in package.json

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package lock was using the older nvm version so thought of updating it will have a separate PR for it

docs/samples/browser-plugin-meetings/app.js Show resolved Hide resolved
@@ -28,7 +28,7 @@ export class MeetingInfoV2PasswordError extends Error {
}

/**
* Error to indicate that wbxappapi requires a captcha
* Error to indicate that prefered webex site not present to start adhoc meeting
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems wrong to be in the wrong place

@@ -65,7 +65,7 @@ export default class MeetingInfoV2 {
* converts hydra id into conversation url and persons Id
* @param {String} destination one of many different types of destinations to look up info for
* @param {String} [type] to match up with the destination value
* @returns {Promise} returns destination and type
* @returns {Promise} returns the meetinginfo of the adhoc meeting
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment update seems wrong, fetchInfoOptions() is used not only for adhoc meetings

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya actually the function only returns the destination type

if (destinationType.type === _CONVERSATION_URL_ && this.webex.config.meetings.experimental.enableAdhocMeetings) {
return this.createAdhocSpaceMeeting(destinationType.destination);
}
console.error('INSIDE', destination);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.error - this shouldn't be here

@@ -34,6 +34,15 @@ export default class MeetingRequest extends StatelessWebexPlugin {
return this.webex.internal.services.fetchClientRegionInfo();
}

/**
* fetch login user infomation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment is off

@@ -64,6 +64,23 @@ MeetingsUtil.checkForCorrelationId = (deviceUrl, locus) => {
return false;
};

MeetingsUtil.parseparseUserPreferences = (userPreferences) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any unit tests for parseparseUserPreferences() or for fetchUserPreferredWebexSite()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually test them from the parent function , we dont have test for the utils functions separately ,

we should have added it but we dont have any currently can create one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move move it back , i was using the register test

it('on register makes sure following functions are called ', async () => { webex.canAuthorize = true; webex.meetings.registered = false; await webex.meetings.register(); assert.called(webex.internal.device.register); assert.called(webex.internal.services.fetchLoginUserInformation); assert.called(webex.internal.services.fetchClientRegionInfo); assert.called(webex.internal.mercury.connect); assert.isTrue(webex.meetings.registered); });

@@ -313,7 +340,7 @@ skipInBrowser(describe)('plugin-meetings', () => {
assert.calledWith(initialSetup, {url: url1});
});
});
describe('destory non active meeting', () => {
xdescribe('destory non active meeting', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a jira for that?

service: 'identity',
resource: 'identity/scim/v1/Users/me?showAllTypes=true'
});
assert.isDefined(res);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could check if res matches what it should be {userPreferences: 'userPreferences'}

});

it('has a webex instance with a meetings property', () => {
assert.exists(webex, 'webex was initialized with children');
assert.exists(webex.meetings, 'meetings child was set up on the webex instance');
});

it('has set up the static config copy', () => {
xit('has set up the static config copy', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I'm confused, are these tests currently running and passing on master or not?

@arun3528 arun3528 force-pushed the adhoc-meeting branch 6 times, most recently from 44c9c30 to 8fb8172 Compare April 14, 2022 16:28
Copy link
Collaborator

@InteractiveTimmy InteractiveTimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

This appears to be related to This Bug. I will test this after merge.

@arun3528
Copy link
Collaborator Author

Screen Shot 2022-04-14 at 4 07 19 PM

one flaky test failing rest good when locally tested

@arun3528 arun3528 merged commit bbeb54d into webex:master Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants