allow poll options with the same text
parent
bb86347362
commit
96ce985cd6
|
@ -296,7 +296,7 @@ class Comment(Base):
|
||||||
else: s = '$$'
|
else: s = '$$'
|
||||||
|
|
||||||
if f'{s}{o.body_html}{s}' in body:
|
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:
|
elif not o.created_utc or o.created_utc < 1677622270:
|
||||||
body += option_body
|
body += option_body
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ class Submission(Base):
|
||||||
else: s = '$$'
|
else: s = '$$'
|
||||||
|
|
||||||
if f'{s}{o.body_html}{s}' in body:
|
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:
|
elif not o.created_utc or o.created_utc < 1677622270:
|
||||||
body += option_body
|
body += option_body
|
||||||
|
|
||||||
|
|
|
@ -502,12 +502,11 @@ def process_poll_options(v:User, target:Union[Submission, Comment]):
|
||||||
|
|
||||||
body_html=filter_emojis_only(body)
|
body_html=filter_emojis_only(body)
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
existing = g.db.query(cls).filter_by(
|
existing = g.db.query(cls).filter_by(
|
||||||
parent_id=target.id,
|
parent_id=target.id,
|
||||||
body_html=body_html,
|
body_html=body_html,
|
||||||
exclusive=exclusive,
|
exclusive=exclusive,
|
||||||
).one_or_none()
|
).first()
|
||||||
|
|
||||||
if not existing:
|
if not existing:
|
||||||
option = cls(
|
option = cls(
|
||||||
|
|
Loading…
Reference in New Issue