return ret
+ def has_avatar(self):
+ has_avatar = self.memcache.get("accounts:%s:has-avatar" % self.uid)
+ if has_avatar is None:
+ has_avatar = True if self.get_avatar() else False
+
+ # Cache avatar status for up to 24 hours
+ self.memcache.set("accounts:%s:has-avatar" % self.uid, has_avatar, 3600 * 24)
+
+ return has_avatar
+
def avatar_url(self, size=None):
url = "https://people.ipfire.org/users/%s.jpg" % self.uid
def upload_avatar(self, avatar):
self._set("jpegPhoto", avatar)
+ # Delete cached avatar status
+ self.memcache.delete("accounts:%s:has-avatar" % self.uid)
+
class StopForumSpam(Object):
def init(self, uid, email, address):
if ret is None:
logging.debug("Found nothing for %s" % key)
else:
- logging.debug("Found object of %s bytes for %s" % (len(ret), key))
+ logging.debug("Found object for %s" % key)
return ret
if ret is None:
logging.debug("Found nothing for %s" % keys)
else:
- logging.debug("Found object of %s bytes for %s" % (len(ret), keys))
+ logging.debug("Found objects for %s" % keys)
return ret
if data is None:
logging.debug("Putting nothing into cache for %s" % key)
else:
- logging.debug("Putting %s bytes into cache for %s" % (len(data), key))
+ logging.debug("Putting object into cache for %s" % key)
return self._connection.add(key, data, *args, **kwargs)
if data is None:
logging.debug("Putting nothing into cache for %s" % key)
else:
- logging.debug("Putting %s bytes into cache for %s" % (len(data), key))
+ logging.debug("Putting object into cache for %s" % key)
return self._connection.set(key, data, *args, **kwargs)
{% block content %}
<section>
- <div class="row">
+ <div class="row mb-5">
<div class="col col-lg-6">
<h1>{{ _("Hello, %s!") % current_user.first_name }}</h1>
</p>
</div>
</div>
+
+ {% if hints %}
+ <div class="card my-5">
+ <div class="card-body">
+ <div class="row">
+ <div class="col-12 col-md-2 text-center">
+ <i class="far fa-smile-wink fa-4x my-3"></i>
+ </div>
+
+ <div class="col-12 col-md-10">
+ <h4 class="mb-0">{{ _("Tell us more about you!") }}</h4>
+ <p>
+ {{ _("Become a part of our community and allow other people to connect with you!") }}
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group list-group-flush">
+ {% for hint in hints %}
+ <a class="list-group-item list-group-item-action" href="/users/{{ current_user.uid }}/edit">
+ {% if hint == "avatar" %}
+ <h6 class="mb-0">{{ _("Upload an avatar!") }}</h6>
+
+ <p class="card-text">
+ {{ _("A picture says more than a thousand words.") }}
+ </p>
+ {% end %}
+ </a>
+ {% end %}
+ </div>
+ </div>
+ {% end %}
</section>
{% end block %}
class IndexHandler(auth.CacheMixin, base.BaseHandler):
@tornado.web.authenticated
def get(self):
- self.render("people/index.html")
+ hints = []
+
+ # Suggest uploading an avatar if this user does not have one
+ if not self.current_user.has_avatar():
+ hints.append("avatar")
+
+ self.render("people/index.html", hints=hints)
class AvatarHandler(base.BaseHandler):