Class: Collavre::TopicsChannel

Inherits:
ApplicationCable::Channel
  • Object
show all
Defined in:
app/channels/collavre/topics_channel.rb

Instance Method Summary collapse

Instance Method Details

#subscribedObject



3
4
5
6
7
8
9
10
11
12
# File 'app/channels/collavre/topics_channel.rb', line 3

def subscribed
  return reject unless params[:creative_id].present? && current_user

  @creative = Creative.find(params[:creative_id]).effective_origin
  return reject unless @creative.has_permission?(current_user, :read)

  stream_for @creative
  # User-specific stream for preference sync (e.g. last_topic_changed)
  stream_for "user_#{current_user.id}_creative_#{@creative.id}"
end