From 2008bc76c1d301ff2ab623d85d64bfa0e216e447 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 5 May 2022 01:31:11 +0200 Subject: [PATCH] cakedays --- files/classes/user.py | 7 +++++-- files/templates/comments.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 80e96cf61..dfc09f689 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -185,8 +185,11 @@ class User(Base): @property @lazy def is_cakeday(self): - print(time.now(), flush=True) - return True + if time.time() - self.created_utc > 363 * 86400: + date = time.strftime("%d %b", time.gmtime(self.created_utc)) + now = time.strftime("%d %b", time.gmtime()) + if date == now: return True + return False @property @lazy diff --git a/files/templates/comments.html b/files/templates/comments.html index fb15d8a86..8fbcc4615 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -207,7 +207,7 @@ {% if not c.author %} {{c.print()}} {% endif %} - {% if c.author.is_cakeday %}{% endif %}{{c.author_name}} + {% if c.author.is_cakeday %}{% endif %}{{c.author_name}} {% if c.author.customtitle %}  {{c.author.customtitle | safe}}{% endif %} {% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 4334b8ec3..4dc3bd2e7 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -657,7 +657,7 @@ {% if p.author.verified %} {% endif %} - {{p.author_name}}{% if p.author.customtitle %}  {{p.author.customtitle | safe}}{% endif %} + {% if p.author.is_cakeday %}{% endif %}{{p.author_name}}{% if p.author.customtitle %}  {{p.author.customtitle | safe}}{% endif %} {% endif %}  {{p.age_string}} ({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.domain %}{{p.domain}}{% else %}text post{% endif %}) diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index c28b84e33..38e5c8ab0 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -192,7 +192,7 @@ {% if p.author.verified %} {% endif %} - {{p.author_name}}{% if p.author.customtitle %}  {{p.author.customtitle | safe}}{% endif %} + {% if p.author.is_cakeday %}{% endif %}{{p.author_name}}{% if p.author.customtitle %}  {{p.author.customtitle | safe}}{% endif %} {% endif %}  {{p.age_string}}