only log edits after 3 minutes have passed

pull/225/head
Aevann 2024-03-08 00:59:07 +02:00
parent 18ba6becd3
commit a0fcd6f6ef
2 changed files with 16 additions and 14 deletions

View File

@ -637,12 +637,13 @@ def edit_comment(cid, v):
if c.author.hieroglyphs and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!")
edit_log = CommentEdit(
comment_id=c.id,
old_body=c.body,
old_body_html=c.body_html,
)
g.db.add(edit_log)
if int(time.time()) - c.created_utc > 60 * 3:
edit_log = CommentEdit(
comment_id=c.id,
old_body=c.body,
old_body_html=c.body_html,
)
g.db.add(edit_log)
oldtext = c.body

View File

@ -1057,14 +1057,15 @@ def edit_post(pid, v):
changed = False
edit_log = PostEdit(
post_id=p.id,
old_title=p.title,
old_title_html=p.title_html,
old_body=p.body,
old_body_html=p.body_html,
)
g.db.add(edit_log)
if int(time.time()) - p.created_utc > 60 * 3:
edit_log = PostEdit(
post_id=p.id,
old_title=p.title,
old_title_html=p.title_html,
old_body=p.body,
old_body_html=p.body_html,
)
g.db.add(edit_log)
if title != p.title:
title_html = filter_emojis_only(title, golden=False, obj=p, author=p.author)