From cc35f0317026426e6625b14bfc3cf298da10740b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 24 Feb 2021 11:09:53 +0000 Subject: [PATCH] Don't send bounces to replies to bounces --- inbox.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/inbox.py b/inbox.py index f44d17d2b..4f70044cb 100644 --- a/inbox.py +++ b/inbox.py @@ -2365,16 +2365,24 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int, nickname, domain, sendH): # send back a bounce DM - if postJsonObject.get('id'): - senderPostId = \ - postJsonObject['id'] - _bounceDM(senderPostId, - session, httpPrefix, - baseDir, nickname, domain, port, - sendH, federationList, - sendThreads, postLog, - cachedWebfingers, personCache, - translate, debug) + if postJsonObject.get('id') and \ + postJsonObject.get('object'): + # don't send bounces back to + # replies to bounce messages + obj = postJsonObject['object'] + if isinstance(obj, dict): + if not obj.get('inReplyTo'): + senderPostId = \ + postJsonObject['id'] + _bounceDM(senderPostId, + session, httpPrefix, + baseDir, + nickname, domain, port, + sendH, federationList, + sendThreads, postLog, + cachedWebfingers, + personCache, + translate, debug) return False # dm index will be updated