forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-11-21 16:11:10 +02:00
parent 27e8a6e622
commit a66dd90553
2 changed files with 12 additions and 6 deletions

View File

@ -19,7 +19,7 @@ def send_notification(uid, text, 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, distinguish_level=6,body=text,
body_html=text_html, body_html=text_html,
notifiedto=uid notifiedto=uid
) )

View File

@ -318,16 +318,18 @@ def message2(v, username):
message = request.values.get("message", "").strip()[:1000].strip() message = request.values.get("message", "").strip()[:1000].strip()
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, message = re.sub('!\[\]\((.*?)\)', r'\1', message)
Comment.sentto == user.id,
Comment.body == message,
).first()
if existing: return redirect('/notifications?messages=true')
text_html = Renderer().render(mistletoe.Document(message)) text_html = Renderer().render(mistletoe.Document(message))
text_html = sanitize(text_html, True) text_html = sanitize(text_html, True)
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.sentto == user.id,
Comment.body_html == text_html,
).first()
if existing: return redirect('/notifications?messages=true')
new_comment = Comment(author_id=v.id, new_comment = Comment(author_id=v.id,
parent_submission=None, parent_submission=None,
level=1, level=1,
@ -371,12 +373,16 @@ def message2(v, username):
def messagereply(v): def messagereply(v):
message = request.values.get("body", "").strip()[:1000].strip() message = request.values.get("body", "").strip()[:1000].strip()
message = re.sub('!\[\]\((.*?)\)', r'\1', message)
id = int(request.values.get("parent_id")) id = int(request.values.get("parent_id"))
parent = get_comment(id, v=v) parent = get_comment(id, v=v)
user = parent.author user = parent.author
text_html = Renderer().render(mistletoe.Document(message)) text_html = Renderer().render(mistletoe.Document(message))
text_html = sanitize(text_html, True) text_html = sanitize(text_html, True)
new_comment = Comment(author_id=v.id, new_comment = Comment(author_id=v.id,
parent_submission=None, parent_submission=None,
parent_comment_id=id, parent_comment_id=id,