remotes/1693045480750635534/spooky-22
Aevann1 2022-03-01 02:20:11 +02:00
parent 5ccc850521
commit 70caa241da
3 changed files with 6 additions and 12 deletions

View File

@ -9,7 +9,6 @@ def create_comment(text_html, autojanny=False):
new_comment = Comment(author_id=author_id, new_comment = Comment(author_id=author_id,
parent_submission=None, parent_submission=None,
distinguish_level=6,
created_utc=0, created_utc=0,
body_html=text_html) body_html=text_html)
g.db.add(new_comment) g.db.add(new_comment)
@ -23,7 +22,7 @@ def send_repeatable_notification(uid, text, autojanny=False):
text_html = sanitize(text) 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: if existing_comment:
cid = existing_comment[0] cid = existing_comment[0]
@ -48,7 +47,7 @@ def notif_comment(text, autojanny=False):
text_html = sanitize(text, alert=True) 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] if existing: return existing[0]
else: return create_comment(text_html, autojanny) else: return create_comment(text_html, autojanny)

View File

@ -247,7 +247,7 @@ def distribute(v, comment):
ma = ModAction( ma = ModAction(
kind="distribute", kind="distribute",
user_id=v.id, user_id=v.id,
target_comment_id=cid target_comment_id=comment
) )
g.db.add(ma) g.db.add(ma)

View File

@ -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) 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 if existing_comment: break
new_comment = Comment(author_id=NOTIFICATIONS_ID, new_comment = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=None, parent_submission=None,
distinguish_level=6,
body_html=body_html, body_html=body_html,
level=1,
) )
db.add(new_comment) db.add(new_comment)
db.flush() db.flush()
@ -761,12 +759,11 @@ def thumbnail_thread(pid):
for i in data: for i in data:
body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) 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 if existing_comment: break
new_comment = Comment(author_id=NOTIFICATIONS_ID, new_comment = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=None, parent_submission=None,
distinguish_level=6,
body_html=body_html body_html=body_html
) )
@ -787,15 +784,13 @@ def thumbnail_thread(pid):
for i in data: for i in data:
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) 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 if existing_comment: break
new_comment = Comment(author_id=NOTIFICATIONS_ID, new_comment = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=None, parent_submission=None,
distinguish_level=6,
body_html=body_html, body_html=body_html,
level=1
) )
db.add(new_comment) db.add(new_comment)
db.flush() db.flush()