From: Michael Tremer Date: Wed, 10 Oct 2018 11:52:15 +0000 (+0100) Subject: Drop gravatar X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1e76401fd289c8d534e4b0626200af8a22f0734;p=ipfire.org.git Drop gravatar Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index d6a31eba..dff71a7c 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -3,7 +3,6 @@ import PIL import io -import hashlib import ldap import logging import urllib.parse @@ -320,8 +319,6 @@ class Account(Object): return url - gravatar_icon = avatar_url - def get_avatar(self, size=None): avatar = self._get_first_attribute("jpegPhoto") if not avatar: @@ -350,19 +347,6 @@ class Account(Object): return f.getvalue() - def get_gravatar_url(self, size=128): - try: - gravatar_email = self.email.lower() - except: - gravatar_email = "nobody@ipfire.org" - - # construct the url - gravatar_url = "https://www.gravatar.com/avatar/" + \ - hashlib.md5(gravatar_email).hexdigest() + "?" - gravatar_url += urllib.parse.urlencode({'d': "mm", 's': str(size)}) - - return gravatar_url - if __name__ == "__main__": a = Accounts() diff --git a/src/templates/blog/author.html b/src/templates/blog/author.html index 46ed84cf..8ed4d01d 100644 --- a/src/templates/blog/author.html +++ b/src/templates/blog/author.html @@ -14,7 +14,7 @@ {% block right %}
- {{ author.name }} + {{ author.name }}

{{ author.name }}

diff --git a/src/templates/nopaste/view.html b/src/templates/nopaste/view.html index 68e2c48c..04e00f0a 100644 --- a/src/templates/nopaste/view.html +++ b/src/templates/nopaste/view.html @@ -39,7 +39,7 @@ {% if entry.account %}
{{ _("Uploaded by") }}
- {{ entry.account.name }} + {{ entry.account.name }} {{ entry.account.name }}
{% elif current_user and entry.address %} diff --git a/src/templates/talk/base.html b/src/templates/talk/base.html index f0ec67f2..b1993643 100644 --- a/src/templates/talk/base.html +++ b/src/templates/talk/base.html @@ -22,7 +22,7 @@
- {{ current_user }} + {{ current_user }}

{{ current_user.name }}

diff --git a/src/templates/talk/conferences.html b/src/templates/talk/conferences.html index 58c52e21..1f8a35ec 100644 --- a/src/templates/talk/conferences.html +++ b/src/templates/talk/conferences.html @@ -22,7 +22,7 @@ {% for p in [p for p in conf.invitees if not current_user == p] %}
  • - {{ p.name }} {{ p.name }} + {{ p.name }} {{ p.name }}
  • {% end %} @@ -40,7 +40,7 @@ {% for p in conf.participants %}
  • {% if p.caller_account %} - {{ p.caller_account.name }} + {{ p.caller_account.name }} {{ p.caller_account.name }} {% else %} {{ p.caller }} diff --git a/src/templates/talk/phonebook-contact.html b/src/templates/talk/phonebook-contact.html index 79856b32..1b7b2ee5 100644 --- a/src/templates/talk/phonebook-contact.html +++ b/src/templates/talk/phonebook-contact.html @@ -9,7 +9,7 @@
    - {{ account.name }} + {{ account.name }}
    {% if account.sip_id %} diff --git a/src/templates/talk/phonebook.html b/src/templates/talk/phonebook.html index 18716f9b..ef099d95 100644 --- a/src/templates/talk/phonebook.html +++ b/src/templates/talk/phonebook.html @@ -16,7 +16,7 @@ Name eMail Phone - Gravatar + Avatar @@ -37,7 +37,7 @@ {% end %} {% end %} - {{ e.name }} + {{ e.name }} {% end %} diff --git a/src/web/handlers_accounts.py b/src/web/handlers_accounts.py index d1dd7fb8..2c740785 100644 --- a/src/web/handlers_accounts.py +++ b/src/web/handlers_accounts.py @@ -32,12 +32,9 @@ class AccountsAvatarHandler(BaseHandler): if avatar: self.memcached.set(cache_handle, avatar, 6 * 3600) - # Otherwise redirect to gravatar + # Otherwise raise 404 (XXX should send a default image) else: - avatar = account.get_gravatar_url(size) - - if avatar.startswith("http://") or avatar.startswith("https://"): - return self.redirect(avatar) + raise tornado.web.HTTPError(404, "No avatar set for %s" % account) self.set_header("Cache-Control", "public,max-age=300") self.set_header("Content-Disposition", "inline; filename=\"%s.jpg\"" % who)