forked from MarseyWorld/MarseyWorld
extend the fix to other endpoints (might make them faster)
parent
1c734cceca
commit
f8cfb96a98
|
@ -393,14 +393,13 @@ def comment(v):
|
|||
post_target.bump_utc = c.created_utc
|
||||
g.db.add(post_target)
|
||||
|
||||
g.db.flush()
|
||||
g.db.commit()
|
||||
gevent.spawn(postprocess_comment, c.body, c.body_html, c.id)
|
||||
|
||||
if c.parent_post:
|
||||
for sort in COMMENT_SORTS.keys():
|
||||
cache.delete(f'post_{c.parent_post}_{sort}')
|
||||
|
||||
gevent.spawn(postprocess_comment, c.body, c.body_html, c.id)
|
||||
|
||||
if v.client: return c.json
|
||||
return {"id": c.id, "comment": render_template("comments.html", v=v, comments=[c])}
|
||||
|
||||
|
@ -788,8 +787,7 @@ def edit_comment(cid, v):
|
|||
g.db.add(n)
|
||||
push_notif({x}, f'New mention of you by @{c.author_name}', c.body, c)
|
||||
|
||||
g.db.flush()
|
||||
|
||||
g.db.commit()
|
||||
gevent.spawn(postprocess_comment, c.body, c.body_html, c.id)
|
||||
else:
|
||||
stop(400, "You need to change something!")
|
||||
|
|
|
@ -775,13 +775,6 @@ def submit_post(v, hole=None):
|
|||
)
|
||||
g.db.add(ma)
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
cache.delete_memoized(userpagelisting)
|
||||
|
||||
g.db.flush() #Necessary, do NOT remove
|
||||
|
||||
generate_thumb = (not p.thumburl and p.url and p.domain != SITE)
|
||||
gevent.spawn(postprocess_post, p.url, p.body, p.body_html, p.id, generate_thumb, False)
|
||||
|
||||
if not p.draft and flag_effortpost and not (SITE_NAME == 'WPD' and v.truescore < 500) and p.can_be_effortpost:
|
||||
body = f"@{v.username} has requested that {p.textlink} be marked as an effortpost!"
|
||||
|
@ -790,6 +783,13 @@ def submit_post(v, hole=None):
|
|||
if p.draft and flag_effortpost and not (SITE_NAME == 'WPD' and v.truescore < 500):
|
||||
p.effortpost = True
|
||||
|
||||
g.db.commit()
|
||||
generate_thumb = (not p.thumburl and p.url and p.domain != SITE)
|
||||
gevent.spawn(postprocess_post, p.url, p.body, p.body_html, p.id, generate_thumb, False)
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
cache.delete_memoized(userpagelisting)
|
||||
|
||||
if v.client: return p.json
|
||||
else:
|
||||
p.voted = 1
|
||||
|
|
Loading…
Reference in New Issue