From 8f2c2885d2f8ed64e8cc88d09802b43e5475e7e6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 23 Jun 2022 00:40:53 +0200 Subject: [PATCH] include psot body in reddit mentions too --- files/helpers/offsitementions.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/files/helpers/offsitementions.py b/files/helpers/offsitementions.py index 4e45f71bef..6865d97fdc 100644 --- a/files/helpers/offsitementions.py +++ b/files/helpers/offsitementions.py @@ -43,9 +43,14 @@ def get_mentions(queries): # Special case: PokemonGoRaids says 'Marsey' a lot unrelated to us. if i['subreddit'] == 'PokemonGoRaids': continue + if kind == 'comment': + text = f'
{i["body"]}
' + else: + text = f'
{i["title"]}

{i["selftext"][:5000]}
' + mentions.append({ 'permalink': i['permalink'], - 'text': i['body' if kind == 'comment' else 'title'], + 'text': text, }) return mentions @@ -57,8 +62,7 @@ def notify_mentions(send_to, mentions, mention_str='site mention'): notif_text = \ f'

New {mention_str}: ' \ - f'https://old.reddit.com{permalink}?context=89

' \ - f'
{text}
' + f'https://old.reddit.com{permalink}?context=89

{text}' \ existing_comment = g.db.query(Comment.id).filter_by( author_id=const.NOTIFICATIONS_ID,