From 7ada3c794c347eb0224609a1cc5617b31a2d84ab Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 29 Jul 2021 07:46:33 +0200 Subject: [PATCH] gfgfgf --- drama/routes/users.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drama/routes/users.py b/drama/routes/users.py index 62caf9781..a77e4da28 100644 --- a/drama/routes/users.py +++ b/drama/routes/users.py @@ -121,6 +121,15 @@ def message2(v, username): if user.is_blocking: return jsonify({"error": "You're blocking this user."}), 403 if user.is_blocked: return jsonify({"error": "This user is blocking you."}), 403 message = request.form.get("message", "")[:1000].strip() + + # check existing + existing = g.db.query(Comment).join(CommentAux).filter(Comment.author_id == v.id, + Comment.deleted_utc == 0, + Comment.parent_submission == None, + CommentAux.body == message, + ).options(contains_eager(Comment.comment_aux)).first() + if existing: return redirect('/notifications?all=true') + send_pm(v.id, user, message) beams_client.publish_to_interests( interests=[str(user.id)],