diff --git a/app/models/user.rb b/app/models/user.rb index 33faa8ee6..45a87dac1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -110,6 +110,15 @@ class User < ApplicationRecord inboxes.where(account_id: Current.account.id) end + alias avatar_img_url avatar_url + def avatar_url + if avatar_img_url == '' + hash = Digest::MD5.hexdigest(email) + return "https://www.gravatar.com/avatar/#{hash}" + end + avatar_img_url + end + def administrator? current_account_user&.administrator? end