aboutsummaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2021-02-02 23:18:27 +0100
committerhellekin <hellekin@cepheide.org>2021-02-02 23:25:57 +0100
commit7f880e3ab041584f77daf098e585bc3c4a08a38a (patch)
tree31bb92a7e60027df4af30153a6781b2f11cf6986 /app/models/user.rb
parentb5739232a535f89b48b54ee52ea7d9bb59f8a46f (diff)
downloadincommon-map-7f880e3ab041584f77daf098e585bc3c4a08a38a.tar.gz
[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.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 6 insertions, 0 deletions
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