diff --git a/docs/samples/browser-plugin-meetings/app.js b/docs/samples/browser-plugin-meetings/app.js index f9c7104edc4..f7ea76c1610 100644 --- a/docs/samples/browser-plugin-meetings/app.js +++ b/docs/samples/browser-plugin-meetings/app.js @@ -226,7 +226,6 @@ function unregister() { }); } - async function getGuestAccessToken() { await axios({ diff --git a/packages/@webex/plugin-meetings/src/meetings/index.ts b/packages/@webex/plugin-meetings/src/meetings/index.ts index 22b7d2cf4d8..70b13840969 100644 --- a/packages/@webex/plugin-meetings/src/meetings/index.ts +++ b/packages/@webex/plugin-meetings/src/meetings/index.ts @@ -761,10 +761,18 @@ export default class Meetings extends WebexPlugin { * @memberof Meetings */ fetchUserPreferredWebexSite() { - return this.request.getMeetingPreferences().then((res) => { - if (res) { - this.preferredWebexSite = MeetingsUtil.parseDefaultSiteFromMeetingPreferences(res); + // @ts-ignore + return this.webex.people._getMe().then((me) => { + const isGuestUser = me.type === 'appuser'; + if (!isGuestUser) { + return this.request.getMeetingPreferences().then((res) => { + if (res) { + this.preferredWebexSite = MeetingsUtil.parseDefaultSiteFromMeetingPreferences(res); + } + }); } + + return Promise.resolve(); }); } @@ -774,7 +782,6 @@ export default class Meetings extends WebexPlugin { * @public * @memberof Meetings */ - getPersonalMeetingRoom() { return this.personalMeetingRoom; } diff --git a/packages/@webex/plugin-meetings/test/unit/spec/meetings/index.js b/packages/@webex/plugin-meetings/test/unit/spec/meetings/index.js index d2d42771657..256d52cb400 100644 --- a/packages/@webex/plugin-meetings/test/unit/spec/meetings/index.js +++ b/packages/@webex/plugin-meetings/test/unit/spec/meetings/index.js @@ -101,6 +101,11 @@ describe('plugin-meetings', () => { Object.assign(webex, { logger, + people: { + _getMe: sinon.stub().resolves({ + type: 'validuser', + }), + } }); Object.assign(webex.meetings, { @@ -1276,6 +1281,17 @@ describe('plugin-meetings', () => { assert.equal(webex.meetings.preferredWebexSite, 'go.webex.com'); }); + it('should not call request.getMeetingPreferences if user is a guest', async () => { + Object.assign(webex.people,{ + _getMe: sinon.stub().returns(Promise.resolve({type: 'appuser'})), + }) + + await webex.meetings.fetchUserPreferredWebexSite(); + + assert.equal(webex.meetings.preferredWebexSite, ''); + assert.notCalled(webex.internal.services.getMeetingPreferences); + }); + it('should not fail if UserPreferred info is not fetched ', async () => { Object.assign(webex.internal, { services: {