Class: Noticed::NotificationChannel

Inherits:
ApplicationCable::Channel
  • Object
show all
Defined in:
lib/noticed/notification_channel.rb

Instance Method Summary collapse

Instance Method Details

#mark_as_read(data) ⇒ Object



11
12
13
# File 'lib/noticed/notification_channel.rb', line 11

def mark_as_read(data)
  current_user.notifications.where(id: data["ids"]).mark_as_read!
end

#subscribedObject



3
4
5
# File 'lib/noticed/notification_channel.rb', line 3

def subscribed
  stream_for current_user
end

#unsubscribedObject



7
8
9
# File 'lib/noticed/notification_channel.rb', line 7

def unsubscribed
  stop_all_streams
end