Commit a7608d29 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'remove-issues-channel' into 'master'

Remove unused IssuesChannel

With 
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59958 
in production, we no longer need this code.

There's no impact to the user since the same feature is
now implemented using GraphQL subscriptions.

See merge request gitlab-org/gitlab!61800
parents 5e5d012c 26a55fa9
# 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
......@@ -42,10 +42,6 @@ module Issues
).execute(spam_params: spam_params)
end
def after_update(issue)
IssuesChannel.broadcast_to(issue, event: 'updated') if Gitlab::ActionCable::Config.in_app? || Feature.enabled?(:broadcast_issue_updates, issue.project)
end
def handle_changes(issue, options)
old_associations = options.fetch(:old_associations, {})
old_labels = old_associations.fetch(:labels, [])
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe IssuesChannel do
let_it_be(:issue) { create(:issue) }
it 'rejects when project path is invalid' do
subscribe(project_path: 'invalid_project_path', iid: issue.iid)
expect(subscription).to be_rejected
end
it 'rejects when iid is invalid' do
subscribe(project_path: issue.project.full_path, iid: non_existing_record_iid)
expect(subscription).to be_rejected
end
it 'rejects when the user does not have access' do
stub_action_cable_connection current_user: nil
subscribe(project_path: issue.project.full_path, iid: issue.iid)
expect(subscription).to be_rejected
end
it 'subscribes to a stream when the user has access' do
stub_action_cable_connection current_user: issue.author
subscribe(project_path: issue.project.full_path, iid: issue.iid)
expect(subscription).to be_confirmed
expect(subscription).to have_stream_for(issue)
end
end
......@@ -1024,10 +1024,8 @@ RSpec.describe Issues::UpdateService, :mailer do
stub_feature_flags(broadcast_issue_updates: feature_flag_enabled)
if should_broadcast
expect(IssuesChannel).to receive(:broadcast_to).with(issue, event: 'updated')
expect(GraphqlTriggers).to receive(:issuable_assignees_updated).with(issue)
else
expect(IssuesChannel).not_to receive(:broadcast_to)
expect(GraphqlTriggers).not_to receive(:issuable_assignees_updated).with(issue)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment