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): if c.author.hieroglyphs and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!") abort(403, "You can only type marseys!")
edit_log = CommentEdit( if int(time.time()) - c.created_utc > 60 * 3:
comment_id=c.id, edit_log = CommentEdit(
old_body=c.body, comment_id=c.id,
old_body_html=c.body_html, old_body=c.body,
) old_body_html=c.body_html,
g.db.add(edit_log) )
g.db.add(edit_log)
oldtext = c.body oldtext = c.body

View File

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