js-skype-status: fixed a bug where subscription to the current users status wouldn't work (#553)

This commit is contained in:
Vincent Biret 2018-07-05 11:51:31 -04:00 committed by Vesa Juvonen
parent 74b748c9e2
commit 711cae3666
3 changed files with 7 additions and 3 deletions

View File

@ -28,6 +28,7 @@ js-skype-status|[Vincent Biret](https://github.com/baywet)
Version|Date|Comments
-------|----|--------
1.2|July 4th, 2018|Fixed a bug when subscribing to the current user's status
1.1|June 22nd, 2018|Upgraded to SPFX 1.5
1.0|December 1, 2017|Initial release
@ -51,7 +52,7 @@ Take note of the `application ID`, we'll need it later. Click on `required permi
![skype permission](./images/5.PNG)
Click on `add` then `select an API` and select `Skype for Business`.
![skype scopes](./images/6.PNG)
Select under `delegated permissions` both `Read/Write Skype user contacts and groups` and `Read/Write Skype user information (preview)`, then click `select`. Finish by clicking `Done`.
Select under `delegated permissions` both `Read/Write Skype user contacts and groups`, `Read/Write Skype user information (preview)`, `Receive conversation invites (preview)` (the receive conversation permission is required to get access to the mePerson object and have access to the current user's presence information) then click `select`. Finish by clicking `Done`.
![grant permission](./images/7.PNG)
Don't forget to click on `Grant permissions` and `yes`.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -22,8 +22,11 @@ export class SkypeForBusinessCommunicationService implements ICommunicationServi
const personsAndGroupsManager: any = skypeApp.personsAndGroupsManager;
const mePerson: any = personsAndGroupsManager.mePerson;
if (SkypeForBusinessCommunicationService.webPartContext().pageContext.user.email === userEmail) {
Log.info(Constants.ErrorCategory, `Bypassed skype subscription for current user ${userEmail}`);
handler("Online", undefined, mePerson.displayName());
mePerson.status.changed((newStatus: string, reason: string, oldStatus: string) => {
Log.info(Constants.ErrorCategory, `${mePerson.displayName()} status changed from ${oldStatus} to ${newStatus} because ${reason}`);
handler(newStatus, oldStatus, mePerson.displayName());
});
mePerson.status.subscribe();
} else {
const query: any = personsAndGroupsManager.createPersonSearchQuery();
query.text(userEmail);