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