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>
This commit is contained in:
24
app/channels/pg_matching_channel.rb
Normal file
24
app/channels/pg_matching_channel.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# 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
|
Reference in New Issue
Block a user