forked from rDrama/rDrama
1
0
Fork 0

show timestamps in the user timezone

master
Aevann1 2022-07-03 09:41:25 +02:00
parent 40182f5f4d
commit 3245656787
15 changed files with 24 additions and 113 deletions

View File

@ -25,16 +25,6 @@ class OauthApp(Base):
return f"<OauthApp(id={self.id})>"
@property
@lazy
def created_date(self):
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@property
@lazy
def permalink(self):
@ -76,14 +66,4 @@ class ClientAuth(Base):
application = relationship("OauthApp")
def __repr__(self):
return f"<ClientAuth(user_id={self.user_id}, oauth_client={self.oauth_client})>"
@property
@lazy
def created_date(self):
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
return f"<ClientAuth(user_id={self.user_id}, oauth_client={self.oauth_client})>"

View File

@ -24,16 +24,6 @@ class Flag(Base):
def __repr__(self):
return f"<Flag(user_id={self.user_id}, post_id={self.post_id})>"
@property
@lazy
def created_date(self):
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@lazy
def realreason(self, v):
return censor_slurs(self.reason, v)
@ -57,16 +47,6 @@ class CommentFlag(Base):
def __repr__(self):
return f"<CommentFlag(user_id={self.user_id}, comment_id={self.comment_id})>"
@property
@lazy
def created_date(self):
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@lazy
def realreason(self, v):
return censor_slurs(self.reason, v)

View File

@ -16,9 +16,4 @@ class Mod(Base):
super().__init__(*args, **kwargs)
def __repr__(self):
return f"<Mod(user_id={self.user_id}, sub={self.sub})>"
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
return f"<Mod(user_id={self.user_id}, sub={self.sub})>"

View File

@ -48,11 +48,6 @@ class SubmissionOptionVote(Base):
def __repr__(self):
return f"<SubmissionOptionVote(option_id={self.option_id}, user_id={self.user_id})>"
@property
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
class CommentOption(Base):
@ -96,8 +91,4 @@ class CommentOptionVote(Base):
super().__init__(*args, **kwargs)
def __repr__(self):
return f"<CommentOptionVote(option_id={self.option_id}, user_id={self.user_id})>"
@property
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
return f"<CommentOptionVote(option_id={self.option_id}, user_id={self.user_id})>"

View File

@ -102,11 +102,6 @@ class Submission(Base):
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@property
@lazy
def age_string(self):
@ -169,12 +164,6 @@ class Submission(Base):
return f"{years}yr ago"
@property
@lazy
def edited_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.edited_utc)))
@property
@lazy
def score(self):

View File

@ -685,18 +685,6 @@ class User(Base):
def applications(self):
return g.db.query(OauthApp).filter_by(author_id=self.id).order_by(OauthApp.id).all()
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@property
@lazy
def last_active_datetime(self):
if self.last_active == 0:
return "never"
return str(time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime(self.last_active)))
@property
@lazy

View File

@ -44,11 +44,6 @@ class Vote(Base):
return data
@property
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
class CommentVote(Base):
__tablename__ = "commentvotes"
@ -86,8 +81,4 @@ class CommentVote(Base):
data["user"]=self.user.json_core
data["comment"]=self.comment.json_core
return data
@property
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
return data

View File

@ -49,4 +49,4 @@
</div>
</div>
<script src="{{asset('js/award_modal.js')}}" data-cfasync="false"></script>
<script src="{{asset('js/award_modal.js')}}"></script>

View File

@ -37,7 +37,7 @@
</a>
</td>
<td>{{vote.user.truecoins}}</td>
<td>{{vote.created_datetime}}</td>
<td data-time="{{vote.created_utc}}"></td>
</tr>
{% endfor %}
</table>

View File

@ -50,19 +50,16 @@
<thead class="thead-dark">
<tr>
<th scope="col">User</th>
<th scope="col">Blocked since</th>
<th scope="col"></th>
<th scope="col">Unblock</th>
</tr>
</thead>
<tbody class="text-muted">
{% for block in v.blocking %}
<tr>
<td>
<a href="{{block.target.permalink}}">
<img loading="lazy" src="{{block.target.profile_url}}" class="pp20 align-top mr-2">@{{block.target.username}}</a>
</td>
<td>{{block.created_date}}</td>
<tr>
<td>
<a href="{{block.target.permalink}}">
<img loading="lazy" src="{{block.target.profile_url}}" class="pp20 align-top mr-2">@{{block.target.username}}</a>
</td>
<td>
<div class="dropdown float-right dropdown-actions">
@ -75,9 +72,9 @@
</div>
</td>
</tr>
{% else %}
{% else %}
<td>There are no blocked users</td>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>

View File

@ -19,7 +19,7 @@
<tr>
<td>{{loop.index}}</td>
<td><a style="color:#{{user.namecolor}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
<td>{{mod.created_datetime}}</td>
<td data-time="{{mod.created_utc}}"></td>
<td>
{% if v.id == user.id or v.mod_date(sub.name) and v.mod_date(sub.name) < mod.created_utc %}
<form action="/h/{{sub.name}}/remove_mod" method="post">

View File

@ -70,7 +70,7 @@
{% endif %}
{% if p.award_count("firework", v) %}
<script defer src="/assets/js/fireworks.js?v=18"></script>
<script src="/assets/js/fireworks.js?v=18"></script>
<div class="firework">
<img src="">
</div>

View File

@ -124,10 +124,10 @@
<a href="/@{{u.username}}/following" id="profile--following">follows {{u.follow_count}} user{{'s' if u.follow_count != 1 else ''}}</a>&nbsp;&nbsp;
<span id="profile--joined">joined <span data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.created_datetime}}">{{u.created_date}}</span></span>
<span id="profile--joined">joined <span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('profile--joined','{{u.created_utc}}')">{{u.created_date}}</span></span>
{% if v and v.admin_level >= 2 -%}
<span id="profile--lastactive" class="ml-2">last active <span data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.last_active_datetime}}">{{u.last_active_date}}</span></span>
<span id="profile--lastactive" class="ml-2">last active <span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('profile--lastactive','{{u.last_active}}')">{{u.last_active_date}}</span></span>
{%- endif %}
</div>
{% if u.basedcount %}<p class="text-muted" id="profile--based">Based Count: {{u.basedcount}}</p>{% endif %}
@ -432,10 +432,10 @@
<br><span id="profile--based">Based count: {{u.basedcount}}</span>
{% endif %}
<br><span id="profile--joined">joined <span data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.created_datetime}}" class="font-weight-bold">{{u.created_date}}</span></span>
<br><span id="profile--joined2">joined <span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('profile--joined2','{{u.created_utc}}')" class="font-weight-bold">{{u.created_date}}</span></span>
{% if v and v.admin_level >= 2 -%}
<br><span id="profile--lastactive">last active <span data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.last_active_datetime}}" class="font-weight-bold">{{u.last_active_date}}</span></span>
<br><span id="profile--lastactive2">last active <span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('profile--lastactive2','{{u.last_active}}')" class="font-weight-bold">{{u.last_active_date}}</span></span>
{%- endif %}
</div>
{% if u.bio_html %}

View File

@ -16,7 +16,7 @@ set CACHE_VER = {
'css/win98.css': 61,
'js/award_modal.js': 253,
'js/bootstrap.js': 272,
'js/bootstrap.js': 273,
'js/comments+submission_listing.js': 262,
'js/submission_listing.js': 261,
'js/emoji_modal.js': 297,

View File

@ -17,7 +17,7 @@
<h1>Info</h1>
<p><a href="{{thing.permalink}}">{{thing.permalink}}</a></p>
<p><b>Author:</b> <a href="{{thing.author.url}}">@{{thing.author.username}}</a></p>
<p><b>Author Created At:</b> {{thing.author.created_datetime}}</p>
<p><b>Author Created At:</b> <span data-time="{{thing.author.created_utc}}"></span></p>
<p><b>Author Truescore:</b> {{thing.author.truecoins}}</p>
<p><b>Upvotes: </b>{{ups | length}}</p>
<p><b>Downvotes: </b>{{downs | length}}</p>
@ -49,7 +49,7 @@
</a>
</td>
<td>{{vote.user.truecoins}}</td>
<td>{{vote.created_datetime}}</td>
<td data-time="{{vote.created_utc}}"></td>
</tr>
{% endfor %}
</table>
@ -77,7 +77,7 @@
</a>
</td>
<td>{{vote.user.truecoins}}</td>
<td>{{vote.created_datetime}}</td>
<td data-time="{{vote.created_utc}}"></td>
</tr>
{% endfor %}
</table>