diff --git a/app/assets/javascripts/shared.js.erb b/app/assets/javascripts/shared.js.erb index 95f00343..dba6461e 100644 --- a/app/assets/javascripts/shared.js.erb +++ b/app/assets/javascripts/shared.js.erb @@ -68,5 +68,10 @@ var showNotification = function(title, options) { } }; -// TODO: only need permissions if the user is signed in -Notification.requestPermission(); +// For now there are notifications only for users signed in and when they +// are in their room's page +$(document).on("turbolinks:load", function() { + if (GreenLight.user.roomOwner) { + Notification.requestPermission(); + } +});