Replaced Gravatar with Pillar-hosted avatars master production
authorSybren A. Stüvel <sybren@stuvel.eu>
Fri, 31 May 2019 13:17:02 +0000 (15:17 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Fri, 31 May 2019 15:03:33 +0000 (17:03 +0200)
Requires Pillar 47474ac936ffb1d179161c8a3cac5d20e6005659

src/templates/svnman/project_settings/settings.pug
svnman/__init__.py

index b3568a3..e0f0d8d 100644 (file)
@@ -42,8 +42,8 @@
                                tr.border-bottom(data-user-id="{{ user['_id'] }}",
                                        class="{% if is_self %}self{% endif %}")
                                        td.py-3
-                                               img.rounded-circle.mx-2(
-                                                       src="{{ user['email'] | gravatar(24) }}")
+                                               img.rounded-circle.mx-2(style="width: 24px; height: 24px",
+                                                       src="{{ user['avatar_url'] }}")
                                                span.access-users-name
                                                        | {{ user['full_name'] }}
                                                        | {% if current_user.objectid == user['_id'] %}
index 4624ca4..70aeded 100644 (file)
@@ -11,6 +11,7 @@ import pillarsdk
 from pillar.extension import PillarExtension
 from pillar.auth import current_user
 from pillar.api.projects import utils as proj_utils
+import pillar.api.users.avatar
 from pillar.api.utils import str2id
 from pillar.api.utils.authorization import require_login
 from pillar.web import utils as web_utils
@@ -159,10 +160,11 @@ class SVNManExtension(PillarExtension):
             svninfo = {str2id(uid): userinfo for uid, userinfo in userdict.items()}
             db_users = users_coll.find(
                 {'_id': {'$in': list(svninfo.keys())}},
-                projection={'full_name': 1, 'email': 1},
+                projection={'full_name': 1, 'email': 1, 'avatar': 1},
             )
             for db_user in db_users:
                 svninfo.setdefault(db_user['_id'], {})['db'] = db_user
+                db_user['avatar_url'] = pillar.api.users.avatar.url(db_user)
 
             svn_users = sorted(svninfo.values(), key=lambda item: item.get('username', ''))