Skip to content

Commit 3cecc98

Browse files
committed
Update web_notifications_channel.js
1 parent 59cf7cb commit 3cecc98

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

app/javascript/channels/web_notifications_channel.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ const wn_struct = {
5555
}
5656
};
5757

58-
if (Notification.permission === "granted") {
59-
consumer.subscriptions.create("WebNotificationsChannel", wn_struct);
60-
}
58+
consumer.subscriptions.create("WebNotificationsChannel", wn_struct);
6159

6260
$(document).on("turbolinks:load", function() {
6361
if (Notification.permission === "default") {
@@ -66,10 +64,7 @@ $(document).on("turbolinks:load", function() {
6664
var btn = $("#notification-permission button");
6765
btn.on("click", function() {
6866
Notification.requestPermission().then(function(permission) {
69-
if (permission === 'granted') {
70-
msg.slideUp();
71-
consumer.subscriptions.create("WebNotificationsChannel", wn_struct);
72-
}
67+
if (permission === 'granted') msg.slideUp();
7368
});
7469
});
7570
msg.slideDown();

0 commit comments

Comments
 (0)