Show a browser notification when a user is waiting to join a room

The owner of a room receives a browser notification if he has the page open
and another person tries to join his room.
This commit is contained in:
Leonardo Crauss Daronco
2016-12-09 13:52:53 -02:00
parent 6726504ec3
commit bf7d087f45
7 changed files with 63 additions and 2 deletions

View File

@ -21,7 +21,7 @@
$(".center-panel-wrapper").html(html);
displayRoomURL();
});
}
};
var initRooms = function() {
App.messages = App.cable.subscriptions.create({
@ -43,6 +43,13 @@
} else if (data.action === 'meeting_ended') {
sessionStatusRefresh($('.meeting-url').val());
showAlert(I18n.meeting_ended, 4000);
} else if (data.action === 'user_waiting') {
// show a browser notification only to the owner
if (GreenLight.user.roomOwner) {
showNotification(I18n.user_waiting_title, {
body: I18n.user_waiting_body.replace(/%{user}/, data.user)
});
}
}
}
});