Hide votes for posts and comments under 24 hours old
This commit is contained in:
parent
120e299f46
commit
4e2047624b
7 changed files with 53 additions and 17 deletions
|
@ -6,7 +6,7 @@ from urllib.parse import urlparse
|
|||
from flask import render_template
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship, deferred
|
||||
from files.__main__ import Base
|
||||
from files.__main__ import Base, app
|
||||
from files.helpers.const import *
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.assetcache import assetcache_path
|
||||
|
@ -84,6 +84,13 @@ class Submission(Base):
|
|||
def __repr__(self):
|
||||
return f"<Submission(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def should_hide_score(self):
|
||||
submission_age_seconds = int(time.time()) - self.created_utc
|
||||
submission_age_hours = submission_age_seconds / (60*60)
|
||||
return submission_age_hours < app.config['SCORE_HIDING_TIME_HOURS']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def controversial(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue