diff --git a/files/classes/comment.py b/files/classes/comment.py index 48e728203..f4dc8f22a 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -296,7 +296,7 @@ class Comment(Base): else: s = '$$' if f'{s}{o.body_html}{s}' in body: - body = body.replace(f'{s}{o.body_html}{s}', option_body) + body = body.replace(f'{s}{o.body_html}{s}', option_body, 1) elif not o.created_utc or o.created_utc < 1677622270: body += option_body diff --git a/files/classes/submission.py b/files/classes/submission.py index dbfddf0e8..a59ea1361 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -325,7 +325,7 @@ class Submission(Base): else: s = '$$' if f'{s}{o.body_html}{s}' in body: - body = body.replace(f'{s}{o.body_html}{s}', option_body) + body = body.replace(f'{s}{o.body_html}{s}', option_body, 1) elif not o.created_utc or o.created_utc < 1677622270: body += option_body diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 4f423bce0..fa9689233 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -502,12 +502,11 @@ def process_poll_options(v:User, target:Union[Submission, Comment]): body_html=filter_emojis_only(body) - g.db.flush() existing = g.db.query(cls).filter_by( parent_id=target.id, body_html=body_html, exclusive=exclusive, - ).one_or_none() + ).first() if not existing: option = cls(