Move post/comment ID boilerplate inside getters.

Borrows code from the upstream which has been working in production
reliably for ~months. Also, most of it was literally copy-pasted,
and the casted ID values aren't used later in the route functions.
This commit is contained in:
TLSM 2022-11-05 18:40:30 -04:00 committed by Ben Rog-Wilhelm
parent 1018cf3412
commit c85cd469a1
6 changed files with 10 additions and 36 deletions

View file

@ -7,10 +7,6 @@ from files.helpers.assetcache import assetcache_path
@app.template_filter("post_embed")
def post_embed(id, v):
try: id = int(id)
except: return None
p = get_post(id, v, graceful=True)
if p: return render_template("submission_listing.html", listing=[p], v=v)