diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/channels/noteable/notes_channel.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/channels/noteable/notes_channel.rb')
-rw-r--r-- | app/channels/noteable/notes_channel.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/channels/noteable/notes_channel.rb b/app/channels/noteable/notes_channel.rb new file mode 100644 index 00000000000..021bc3ccd1b --- /dev/null +++ b/app/channels/noteable/notes_channel.rb @@ -0,0 +1,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 |