From c9890feb4ae26519971e3f7bd7c9f513eaa31ae6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 28 Jan 2022 08:34:09 +0200 Subject: [PATCH] fsd --- files/helpers/const.py | 2 +- files/routes/comments.py | 2 ++ files/routes/users.py | 49 ++++++++++++++++++++-------------------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 96a75390e..05674ec42 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -524,4 +524,4 @@ NOTIFIED_USERS = { 'kippy': KIPPY_ID, } -FORTUNE_REPLIES = ('Your fortune: Allah Wills It','Your fortune: Inshallah, Only Good Things Shall Come To Pass','Your fortune: Allah Smiles At You This Day','Your fortune: Your Bussy Is In For A Blasting','Your fortune: You Will Be Propositioned By A High-Tier Twink','Your fortune: Repent, You Have Displeased Allah And His Vengeance Is Nigh','Your fortune: Reply Hazy, Try Again','Your fortune: lmao you just lost 100 dramacoin','Your fortune: Yikes 😬','Your fortune: You Will Be Blessed With Many Black Bulls','Your fortune: NEETmax, The Day Is Lost If You Venture Outside','Your fortune: A Taste Of Jannah Awaits You Today','Your fortune: Watch Your Back') +FORTUNE_REPLIES = ('Your fortune: Allah Wills It','Your fortune: Inshallah, Only Good Things Shall Come To Pass','Your fortune: Allah Smiles At You This Day','Your fortune: Your Bussy Is In For A Blasting','Your fortune: You Will Be Propositioned By A High-Tier Twink','Your fortune: Repent, You Have Displeased Allah And His Vengeance Is Nigh','Your fortune: Reply Hazy, Try Again','Your fortune: lmao you just lost 100 dramacoin','Your fortune: Yikes 😬','Your fortune: You Will Be Blessed With Many Black Bulls','Your fortune: NEETmax, The Day Is Lost If You Venture Outside','Your fortune: A Taste Of Jannah Awaits You Today','Your fortune: Watch Your Back','Your fortune: Outlook good','Your fortune: Godly Luck','Your fortune: Good Luck','Your fortune: Bad Luck','Your fortune: Good news will come to you by mail','Your fortune: Very Bad Luck','Your fortune: Reply hazy, try again','Your fortune: キタ━━━━━━(οΎŸβˆ€οΎŸ)━━━━━━ !!!!','Your fortune: Better not tell you now','Your fortune: You will meet a dark handsome stranger','Your fortune: οΌˆγ€€Β΄_ゝ`οΌ‰οΎŒο½°οΎ','Your fortune: Excellent Luck','Your fortune: Average Luck') diff --git a/files/routes/comments.py b/files/routes/comments.py index 04b152fba..1251bd773 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -48,6 +48,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): if comment.post and comment.post.club and not (v and (v.paid_dues or v.id in [comment.author_id, comment.post.author_id])): abort(403) + if comment.post and comment.post.private and not (v and (v.admin_level > 1 or v.id == comment.post.author.id)): abort(403) + if not comment.parent_submission and not (v and (comment.author.id == v.id or comment.sentto == v.id)) and not (v and v.admin_level > 1) : abort(403) if not pid: diff --git a/files/routes/users.py b/files/routes/users.py index 4c4caa06b..654a65f00 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -534,35 +534,36 @@ def messagereply(v): g.db.add(new_comment) g.db.flush() - if PUSHER_ID and user_id != v.id: + if user_id != v.id: notif = Notification(comment_id=new_comment.id, user_id=user_id) g.db.add(notif) - if len(message) > 500: notifbody = message[:500] + '...' - else: notifbody = message - - beams_client.publish_to_interests( - interests=[f'{request.host}{user_id}'], - publish_body={ - 'web': { - 'notification': { - 'title': f'New message from @{v.username}', - 'body': notifbody, - 'deep_link': f'{SITE_FULL}/notifications?messages=true', - 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp', + if PUSHER_ID: + if len(message) > 500: notifbody = message[:500] + '...' + else: notifbody = message + + beams_client.publish_to_interests( + interests=[f'{request.host}{user_id}'], + publish_body={ + 'web': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': notifbody, + 'deep_link': f'{SITE_FULL}/notifications?messages=true', + 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp', + } + }, + 'fcm': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': notifbody, + }, + 'data': { + 'url': '/notifications?messages=true', + } } }, - 'fcm': { - 'notification': { - 'title': f'New message from @{v.username}', - 'body': notifbody, - }, - 'data': { - 'url': '/notifications?messages=true', - } - } - }, - ) + ) if new_comment.top_comment.sentto == 0: