Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/channels/activity_notification/notification_api_channel.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
if defined?(ActionCable)
# Action Cable API channel to subscribe broadcasted notifications.
class ActivityNotification::NotificationApiChannel < ActivityNotification::NotificationChannel
# ActionCable::Channel::Base#subscribed
# @see https://api.rubyonrails.org/classes/ActionCable/Channel/Base.html#method-i-subscribed
# Action Cable API channel to subscribe broadcasted notifications.
class ActivityNotification::NotificationApiChannel < ActivityNotification::NotificationChannel
if defined?(ActionCable)
# ActionCable::Channel::Base#subscribed
# @see https://api.rubyonrails.org/classes/ActionCable/Channel/Base.html#method-i-subscribed
def subscribed
stream_from "#{ActivityNotification.config.notification_api_channel_prefix}_#{@target.to_class_name}#{ActivityNotification.config.composite_key_delimiter}#{@target.id}"
rescue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if defined?(ActionCable)
# Action Cable API channel to subscribe broadcasted notifications with Devise authentication.
class ActivityNotification::NotificationApiWithDeviseChannel < ActivityNotification::NotificationApiChannel
# Action Cable API channel to subscribe broadcasted notifications with Devise authentication.
class ActivityNotification::NotificationApiWithDeviseChannel < ActivityNotification::NotificationApiChannel
if defined?(ActionCable)
# Include PolymorphicHelpers to resolve string extentions
include ActivityNotification::PolymorphicHelpers

Expand Down
2 changes: 2 additions & 0 deletions app/channels/activity_notification/notification_channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ def authenticate_target!
reject if @target.nil? || @target.notification_action_cable_with_devise?
end
end
else
class ActivityNotification::NotificationChannel; end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if defined?(ActionCable)
# Action Cable channel to subscribe broadcasted notifications with Devise authentication.
class ActivityNotification::NotificationWithDeviseChannel < ActivityNotification::NotificationChannel
# Action Cable channel to subscribe broadcasted notifications with Devise authentication.
class ActivityNotification::NotificationWithDeviseChannel < ActivityNotification::NotificationChannel
if defined?(ActionCable)
# Include PolymorphicHelpers to resolve string extentions
include ActivityNotification::PolymorphicHelpers

Expand Down