gf
This commit is contained in:
parent
f7fcefebd6
commit
5d0da0e0e7
3 changed files with 6 additions and 12 deletions
|
@ -9,7 +9,6 @@ def create_comment(text_html, autojanny=False):
|
|||
|
||||
new_comment = Comment(author_id=author_id,
|
||||
parent_submission=None,
|
||||
distinguish_level=6,
|
||||
created_utc=0,
|
||||
body_html=text_html)
|
||||
g.db.add(new_comment)
|
||||
|
@ -23,7 +22,7 @@ def send_repeatable_notification(uid, text, autojanny=False):
|
|||
|
||||
text_html = sanitize(text)
|
||||
|
||||
existing_comment = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, distinguish_level=6, body_html=text_html, created_utc=0).first()
|
||||
existing_comment = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html, created_utc=0).first()
|
||||
|
||||
if existing_comment:
|
||||
cid = existing_comment[0]
|
||||
|
@ -48,7 +47,7 @@ def notif_comment(text, autojanny=False):
|
|||
|
||||
text_html = sanitize(text, alert=True)
|
||||
|
||||
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, distinguish_level=6, body_html=text_html, created_utc=0).one_or_none()
|
||||
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html, created_utc=0).one_or_none()
|
||||
|
||||
if existing: return existing[0]
|
||||
else: return create_comment(text_html, autojanny)
|
||||
|
|
|
@ -247,7 +247,7 @@ def distribute(v, comment):
|
|||
ma = ModAction(
|
||||
kind="distribute",
|
||||
user_id=v.id,
|
||||
target_comment_id=cid
|
||||
target_comment_id=comment
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
|
|
|
@ -735,14 +735,12 @@ def thumbnail_thread(pid):
|
|||
|
||||
body_html = sanitize(f'New {word} mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1).one_or_none()
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, body_html=body_html).one_or_none()
|
||||
if existing_comment: break
|
||||
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
parent_submission=None,
|
||||
distinguish_level=6,
|
||||
body_html=body_html,
|
||||
level=1,
|
||||
)
|
||||
db.add(new_comment)
|
||||
db.flush()
|
||||
|
@ -761,12 +759,11 @@ def thumbnail_thread(pid):
|
|||
for i in data:
|
||||
body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html).one_or_none()
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None,body_html=body_html).one_or_none()
|
||||
if existing_comment: break
|
||||
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
parent_submission=None,
|
||||
distinguish_level=6,
|
||||
body_html=body_html
|
||||
)
|
||||
|
||||
|
@ -787,15 +784,13 @@ def thumbnail_thread(pid):
|
|||
for i in data:
|
||||
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1).one_or_none()
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, body_html=body_html).one_or_none()
|
||||
|
||||
if existing_comment: break
|
||||
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
parent_submission=None,
|
||||
distinguish_level=6,
|
||||
body_html=body_html,
|
||||
level=1
|
||||
)
|
||||
db.add(new_comment)
|
||||
db.flush()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue