forked from rDrama/rDrama
fdfd
parent
7ada3c794c
commit
eaa927545e
|
@ -37,8 +37,6 @@ def send_notification(vid, user, text):
|
||||||
|
|
||||||
def send_pm(vid, user, text):
|
def send_pm(vid, user, text):
|
||||||
|
|
||||||
text = text.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n")
|
|
||||||
|
|
||||||
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(text))
|
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(text))
|
||||||
|
|
||||||
text_html = sanitize(text_html, linkgen=True)
|
text_html = sanitize(text_html, linkgen=True)
|
||||||
|
|
|
@ -73,6 +73,14 @@ def messagereply(v, username, id):
|
||||||
message = request.form.get("message", "")[:1000].strip()
|
message = request.form.get("message", "")[:1000].strip()
|
||||||
user = get_user(username)
|
user = get_user(username)
|
||||||
message = message.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n")
|
message = message.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n")
|
||||||
|
|
||||||
|
# check existing
|
||||||
|
existing = g.db.query(Comment).join(CommentAux).filter(Comment.author_id == v.id,
|
||||||
|
Comment.sentto == user.id,
|
||||||
|
CommentAux.body == message,
|
||||||
|
).options(contains_eager(Comment.comment_aux)).first()
|
||||||
|
if existing: return redirect('/notifications?all=true')
|
||||||
|
|
||||||
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(message))
|
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(message))
|
||||||
text_html = sanitize(text_html, linkgen=True)
|
text_html = sanitize(text_html, linkgen=True)
|
||||||
parent = get_comment(int(id), v=v)
|
parent = get_comment(int(id), v=v)
|
||||||
|
@ -122,10 +130,11 @@ def message2(v, username):
|
||||||
if user.is_blocked: return jsonify({"error": "This user is blocking you."}), 403
|
if user.is_blocked: return jsonify({"error": "This user is blocking you."}), 403
|
||||||
message = request.form.get("message", "")[:1000].strip()
|
message = request.form.get("message", "")[:1000].strip()
|
||||||
|
|
||||||
|
message = message.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n")
|
||||||
|
|
||||||
# check existing
|
# check existing
|
||||||
existing = g.db.query(Comment).join(CommentAux).filter(Comment.author_id == v.id,
|
existing = g.db.query(Comment).join(CommentAux).filter(Comment.author_id == v.id,
|
||||||
Comment.deleted_utc == 0,
|
Comment.sentto == user.id,
|
||||||
Comment.parent_submission == None,
|
|
||||||
CommentAux.body == message,
|
CommentAux.body == message,
|
||||||
).options(contains_eager(Comment.comment_aux)).first()
|
).options(contains_eager(Comment.comment_aux)).first()
|
||||||
if existing: return redirect('/notifications?all=true')
|
if existing: return redirect('/notifications?all=true')
|
||||||
|
|
Loading…
Reference in New Issue