summaryrefslogtreecommitdiff
path: root/app/channels/issues_channel.rb
blob: 5f3909b77167fc86d8ffe25fc2df5a3e27e2035c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class IssuesChannel < ApplicationCable::Channel
  def subscribed
    project = Project.find_by_full_path(params[:project_path])
    return reject unless project

    issue = project.issues.find_by_iid(params[:iid])
    return reject unless issue && Ability.allowed?(current_user, :read_issue, issue)

    stream_for issue
  end
end