feat: use gravatar if no avatar image (#1307)

Fixes:  #1240
This commit is contained in:
Arman 2020-10-04 16:25:22 +05:30 committed by GitHub
parent 807f79ef5d
commit 3d379b071d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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