add comment count column to submissions
ALTER TABLE submissions add column comment_count integer default 0; update submissions set comment_count=(select count(id) from comments where parent_submission=submissions.id);
This commit is contained in:
parent
428fee9854
commit
33d58691f9
2 changed files with 7 additions and 5 deletions
|
@ -269,8 +269,14 @@ def api_comment(v):
|
|||
app_id=v.client.application.id if v.client else None,
|
||||
shadowbanned=v.shadowbanned
|
||||
)
|
||||
|
||||
g.db.add(c)
|
||||
g.db.flush()
|
||||
|
||||
parent_post.comment_count = g.db.query(Comment).filter_by(parent_submission=parent_post.id).count()
|
||||
g.db.add(parent_post)
|
||||
g.db.flush()
|
||||
|
||||
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue