Files
codeocean/app/channels/pg_matching_channel.rb
Kira Grammel 8a5dc7abc0 Forward person when a programming group is created with them
Further, we remove the "check invitation" button and extract some methods to our new ProgrammingGroups object in JavaScript.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
2023-09-19 20:14:33 +00:00

25 lines
532 B
Ruby

# frozen_string_literal: true
class PgMatchingChannel < ApplicationCable::Channel
def subscribed
set_and_authorize_exercise
stream_from specific_channel
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
stop_all_streams
end
def specific_channel
"pg_matching_channel_exercise_#{@exercise.id}"
end
private
def set_and_authorize_exercise
@exercise = Exercise.find(params[:exercise_id])
reject unless ExercisePolicy.new(current_user, @exercise).implement?
end
end