Add events for pair programming study

This commit is contained in:
kiragrammel
2023-09-04 23:57:30 +02:00
committed by Sebastian Serth
parent d1d5b0df6f
commit 79422225a8
15 changed files with 224 additions and 15 deletions

View File

@ -24,6 +24,7 @@ module ApplicationCable
def find_verified_user
# Finding the current_user is similar to the code used in application_controller.rb#current_user
current_user = ExternalUser.find_by(id: session[:external_user_id]) || InternalUser.find_by(id: session[:user_id])
current_user&.store_current_study_group_id(session[:study_group_id])
current_user || reject_unauthorized_connection
end

View File

@ -22,7 +22,10 @@ class SynchronizedEditorChannel < ApplicationCable::Channel
end
def send_changes(message)
ActionCable.server.broadcast(specific_channel, message['delta_with_user_id'])
change = message['delta_with_user_id'].deep_symbolize_keys
Event::SynchronizedEditor.create_for_editor_change(change, current_user, programming_group)
ActionCable.server.broadcast(specific_channel, change)
end
def send_hello