From f083e148a41e5a1bb1fb6640b2fd08e89157ada1 Mon Sep 17 00:00:00 2001 From: Gift Segun Adesigbin Date: Thu, 15 Sep 2022 10:59:04 +0100 Subject: [PATCH] Update user_notification_channel.rb --- app/channels/user_notification_channel.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/channels/user_notification_channel.rb b/app/channels/user_notification_channel.rb index 04415cb27c..7e598e0797 100644 --- a/app/channels/user_notification_channel.rb +++ b/app/channels/user_notification_channel.rb @@ -1,11 +1,12 @@ class UserNotificationChannel < ApplicationCable::Channel - def subscribed - if !current_user.nil? - stream_from "users:notification:#{current_user.id}" - else + def subscribed + if current_user.nil? reject + else + stream_from "users:notification:#{current_user.id}" end end + def unsubscribed # Any cleanup needed when channel is unsubscribed