Welcome to mirror list, hosted at ThFree Co, Russian Federation.

notes_channel.rb « noteable « channels « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 021bc3ccd1bd935f36e6a84a3304e87732bec104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Noteable
  class NotesChannel < ApplicationCable::Channel
    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?
      return reject if Feature.disabled?(:action_cable_notes, project || noteable.try(:group))

      stream_for noteable
    rescue ActiveRecord::RecordNotFound
      reject
    end
  end
end