Class: Noteable::NotesChannel

Inherits:
ApplicationCable::Channel show all
Defined in:
app/channels/noteable/notes_channel.rb

Instance Method Summary collapse

Instance Method Details

#subscribedObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/channels/noteable/notes_channel.rb', line 5

def subscribed
  project = Project.find(params[:project_id]) if params[:project_id].present?

  noteable = NotesFinder.new(current_user, {
    project: project,
    group_id: params[:group_id],
    target_type: params[:noteable_type],
    target_id: params[:noteable_id]
  }).target

  return reject if noteable.nil?

  stream_for noteable
rescue ActiveRecord::RecordNotFound
  reject
end