From 7f880e3ab041584f77daf098e585bc3c4a08a38a Mon Sep 17 00:00:00 2001 From: hellekin Date: Tue, 2 Feb 2021 23:18:27 +0100 Subject: [FIX] Account for users without an avatar or group 1. Ensure new users belong to an Agent Users may come without the correct group information, leading to a situation where they have no Agent assigned to them. The application cannot handle this, so we ensure new users are at least associated to the new Anonymous Agent. 2. Introduce a default avatar Users coming without an avatar would see a broken view. Now they're assigned a default avatar, which shows the IN COMMON icon logo instead. --- app/controllers/welcome_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 85246e5..5fce0cf 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -121,16 +121,15 @@ class WelcomeController < ApplicationController # Update user agents def perform_background_jobs if @current_user.present? - AgencyWatcherJob.perform_later(@current_user, @sso.user_info[:groups].split(',')) + EnsureAgentJob.perform_later(@current_user, @sso.user_info[:groups].split(',')) end end # Save User ID and current agent in session def update_current_session if @current_user.present? - session[:current_user] = @current_user[:external_id] - # TODO: make this a bit smarter - session[:current_agent] = @current_user&.agents&.pluck(:name)&.last + session[:current_user] = @current_user[:external_id] + session[:current_agent] = current_agent_name end end end -- cgit v1.2.3