Generate Session ID on server for synchronized editor

This change allows us to use the session ID immediately for the connection_change and connection_status methods. Hence, we can identify different browser sessions of the same user.
This commit is contained in:
Sebastian Serth
2023-09-12 17:39:45 +02:00
committed by Sebastian Serth
parent 914adeed42
commit cc90861bd5
5 changed files with 22 additions and 13 deletions

View File

@ -25,9 +25,9 @@ class Event::SynchronizedEditor < ApplicationRecord
remove: 1,
}, _prefix: true
validates :session_id, presence: true
validates :status, presence: true, if: -> { action_connection_change? }
validates :file_id, presence: true, if: -> { action_editor_change? }
validates :session_id, presence: true, if: -> { action_editor_change? }
validates :editor_action, presence: true, if: -> { action_editor_change? }
validates :range_start_row, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
validates :range_start_column, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
@ -64,6 +64,7 @@ class Event::SynchronizedEditor < ApplicationRecord
user:,
programming_group:,
study_group_id: user.current_study_group_id,
session_id: message[:session_id],
action: message[:action],
status: message[:status]
)