fdssdf
This commit is contained in:
parent
2d8f871d51
commit
31fe4f857a
2 changed files with 19 additions and 10 deletions
|
@ -13,13 +13,11 @@ def send_notification(uid, text, autojanny=False):
|
||||||
text_html = CustomRenderer().render(mistletoe.Document(text))
|
text_html = CustomRenderer().render(mistletoe.Document(text))
|
||||||
text_html = sanitize(text_html)
|
text_html = sanitize(text_html)
|
||||||
|
|
||||||
author_id = AUTOJANNY_ID
|
if autojanny: author_id = AUTOJANNY_ID
|
||||||
|
else:
|
||||||
# if autojanny: author_id = AUTOJANNY_ID
|
author_id = NOTIFICATIONS_ID
|
||||||
# else:
|
existing = g.db.query(Comment.id).filter(Comment.author_id == author_id, Comment.body_html == text_html, Comment.notifiedto == uid).first()
|
||||||
# author_id = NOTIFICATIONS_ID
|
if existing: return
|
||||||
# existing = g.db.query(Comment.id).filter(Comment.author_id == author_id, Comment.body_html == text_html, Comment.notifiedto == uid).first()
|
|
||||||
# if existing: return
|
|
||||||
|
|
||||||
new_comment = Comment(author_id=author_id,
|
new_comment = Comment(author_id=author_id,
|
||||||
parent_submission=None,
|
parent_submission=None,
|
||||||
|
@ -31,8 +29,7 @@ def send_notification(uid, text, autojanny=False):
|
||||||
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
notif = Notification(comment_id=new_comment.id,
|
notif = Notification(comment_id=new_comment.id, user_id=uid)
|
||||||
user_id=uid)
|
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,21 @@ else: cc = "country club"
|
||||||
@app.get("/notify")
|
@app.get("/notify")
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
def notify(v):
|
def notify(v):
|
||||||
|
|
||||||
|
text_html = sanitize(CustomRenderer().render(mistletoe.Document("IMPORTANT: https://rdrama.net/post/30782/psa-make-sure-you-know-your")))
|
||||||
|
|
||||||
|
new_comment = Comment(author_id=AUTOJANNY_ID,
|
||||||
|
parent_submission=None,
|
||||||
|
distinguish_level=6,
|
||||||
|
body_html=text_html)
|
||||||
|
g.db.add(new_comment)
|
||||||
|
g.db.flush()
|
||||||
|
|
||||||
users = (x[0] for x in g.db.query(User.id).all())
|
users = (x[0] for x in g.db.query(User.id).all())
|
||||||
for u in users:
|
for u in users:
|
||||||
send_notification(u, f"IMPORTANT: https://rdrama.net/post/30782/psa-make-sure-you-know-your")
|
notif = Notification(comment_id=new_comment.id, user_id=u)
|
||||||
|
g.db.add(notif)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return "sex"
|
return "sex"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue