Add gravatar to profile page. Attempt to make profile look nicer.

This commit is contained in:
Christoph Haas 2021-03-10 02:33:40 +01:00
parent d504e5e914
commit 4e07bf00fd
6 changed files with 116 additions and 47 deletions

View file

@ -20,6 +20,9 @@ class User < ApplicationRecord
# :github
]
include Gravtastic
gravtastic size: 120
# Return a human-friendly string describing the user's SSO provider
def pretty_provider
case self.provider
@ -40,11 +43,24 @@ class User < ApplicationRecord
end
end
# Check if a user has been created on-the-fly and is just an
# anonymous user who uploaded a screenshot. They can turn this
# user record into a registered account though.
def is_anonymous?
self.provider == nil
def pretty_name
if self.pseudo
'Anonymous'
elsif self.name?
self.name
else
'Dr. Who'
end
end
def pretty_role
if self.pseudo
'Contributor'
elsif self.moderator_role
'Moderator'
elsif self.admin_role
'Admin'
end
end
def self.from_omniauth(auth)