forked from rDrama/rDrama
sneed
parent
027e775975
commit
091679142e
|
@ -277,6 +277,28 @@ class User(Base, Stndrd, Age_times):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<User(username={self.username})>"
|
return f"<User(username={self.username})>"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unban_string(self):
|
||||||
|
if self.unban_utc == 0:
|
||||||
|
return "permanently banned"
|
||||||
|
|
||||||
|
wait = self.unban_utc - int(time.time())
|
||||||
|
|
||||||
|
if wait < 60:
|
||||||
|
text = "a few moments"
|
||||||
|
else:
|
||||||
|
days = wait//(24*60*60)
|
||||||
|
wait -= days*24*60*60
|
||||||
|
|
||||||
|
hours = wait//(60*60)
|
||||||
|
wait -= hours*60*60
|
||||||
|
|
||||||
|
mins = wait//60
|
||||||
|
|
||||||
|
text = f"{days} days {hours:02d} hours {mins:02d} minutes"
|
||||||
|
|
||||||
|
return f"Unban in {text}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def post_notifications_count(self):
|
def post_notifications_count(self):
|
||||||
|
|
|
@ -304,9 +304,9 @@ def u_username(username, v=None):
|
||||||
listing = get_posts(ids, v=v)
|
listing = get_posts(ids, v=v)
|
||||||
|
|
||||||
if u.unban_utc:
|
if u.unban_utc:
|
||||||
unban = datetime.fromtimestamp(u.unban_utc).strftime('%c')
|
#unban = datetime.fromtimestamp(u.unban_utc).strftime('%c')
|
||||||
return {'html': lambda: render_template("userpage.html",
|
return {'html': lambda: render_template("userpage.html",
|
||||||
unban=unban,
|
unban=u.unban_string,
|
||||||
u=u,
|
u=u,
|
||||||
v=v,
|
v=v,
|
||||||
listing=listing,
|
listing=listing,
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<div class="ml-3 w-100">
|
<div class="ml-3 w-100">
|
||||||
{% if u.is_banned %}
|
{% if u.is_banned %}
|
||||||
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
||||||
{% if unban %} <h5 style="color:#ff66ac;">until {{unban}}</h5>{% endif %}
|
{% if unban %} <h5 style="color:#ff66ac;">{{unban}}</h5>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="d-flex align-items-center mt-1 mb-2">
|
<div class="d-flex align-items-center mt-1 mb-2">
|
||||||
|
@ -282,7 +282,7 @@
|
||||||
<div class="mt-n3 py-3">
|
<div class="mt-n3 py-3">
|
||||||
{% if u.is_banned %}
|
{% if u.is_banned %}
|
||||||
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
||||||
{% if unban %} <h5 style="color:#ff66ac;">until {{unban}}</h5>{% endif %}
|
{% if unban %} <h5 style="color:#ff66ac;">{{unban}}</h5>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="text-black"><h1 class="h5 d-inline-block" style="color: #{{u.namecolor}}">{{u.username}}</h1></a>
|
<a class="text-black"><h1 class="h5 d-inline-block" style="color: #{{u.namecolor}}">{{u.username}}</h1></a>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue