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/models/user.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models/user.rb') diff --git a/app/models/user.rb b/app/models/user.rb index 9b199ac..7288412 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,4 +5,10 @@ class User < ApplicationRecord has_many :agencies has_many :agents, through: :agencies, source: :agent + + include UsersHelper + + def avatar_url + attributes[:avatar_url] || default_user_avatar_url + end end -- cgit v1.2.3