Class: Noteable::NotesChannel

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

Constant Summary

Constants included from Gitlab::Auth::AuthFinders

Gitlab::Auth::AuthFinders::DEPLOY_TOKEN_HEADER, Gitlab::Auth::AuthFinders::HEADER_TOKEN_KEYS, Gitlab::Auth::AuthFinders::JOB_TOKEN_HEADER, Gitlab::Auth::AuthFinders::JOB_TOKEN_PARAM, Gitlab::Auth::AuthFinders::MAX_JOB_TOKEN_SIZE_BYTES, Gitlab::Auth::AuthFinders::PARAM_TOKEN_KEYS, Gitlab::Auth::AuthFinders::PRIVATE_TOKEN_HEADER, Gitlab::Auth::AuthFinders::PRIVATE_TOKEN_PARAM, Gitlab::Auth::AuthFinders::RUNNER_JOB_TOKEN_PARAM, Gitlab::Auth::AuthFinders::RUNNER_TOKEN_PARAM

Instance Attribute Summary

Attributes included from Gitlab::Auth::AuthFinders

#current_token

Instance Method Summary collapse

Methods inherited from ApplicationCable::Channel

#authorization_scopes, #validate_user_authorization

Methods included from Gitlab::Auth::AuthFinders

#authentication_token_present?, #cluster_agent_token_from_authorization_token, #deploy_token_from_request, #find_job_from_job_token, #find_runner_from_token, #find_user_from_access_token, #find_user_from_basic_auth_password, #find_user_from_bearer_token, #find_user_from_feed_token, #find_user_from_job_token, #find_user_from_lfs_token, #find_user_from_personal_access_token, #find_user_from_static_object_token, #find_user_from_warden, #find_user_from_web_access_token, path_dependent_feed_token_regex, #validate_and_save_access_token!

Methods included from Gitlab::RackLoadBalancingHelpers

#load_balancer_stick_request

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