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

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

View File

@ -27,6 +27,7 @@ react-skype-status|[Vincent Biret](https://github.com/baywet)
Version|Date|Comments Version|Date|Comments
-------|----|-------- -------|----|--------
1.2|July 4th, 2018|Fixed a bug when subscribing to the current user's status
1.1|June 25th, 2018|Upgrade to 1.5 1.1|June 25th, 2018|Upgrade to 1.5
1.0|December 1, 2017|Initial release 1.0|December 1, 2017|Initial release
@ -50,7 +51,7 @@ Take note of the `application ID`, we'll need it later. Click on `required permi
![skype permission](./images/5.PNG) ![skype permission](./images/5.PNG)
Click on `add` then `select an API` and select `Skype for Business`. Click on `add` then `select an API` and select `Skype for Business`.
![skype scopes](./images/6.PNG) ![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) ![grant permission](./images/7.PNG)
Don't forget to click on `Grant permissions` and `yes`. 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 personsAndGroupsManager: any = skypeApp.personsAndGroupsManager;
const mePerson: any = personsAndGroupsManager.mePerson; const mePerson: any = personsAndGroupsManager.mePerson;
if (SkypeForBusinessCommunicationService.webPartContext().pageContext.user.email === userEmail) { if (SkypeForBusinessCommunicationService.webPartContext().pageContext.user.email === userEmail) {
Log.info(Constants.ErrorCategory, `Bypassed skype subscription for current user ${userEmail}`); mePerson.status.changed((newStatus: string, reason: string, oldStatus: string) => {
handler("Online", undefined, mePerson.displayName()); Log.info(Constants.ErrorCategory, `${mePerson.displayName()} status changed from ${oldStatus} to ${newStatus} because ${reason}`);
handler(newStatus, oldStatus, mePerson.displayName());
});
mePerson.status.subscribe();
} else { } else {
const query: any = personsAndGroupsManager.createPersonSearchQuery(); const query: any = personsAndGroupsManager.createPersonSearchQuery();
query.text(userEmail); query.text(userEmail);