From 07bd5abeb4ad5593aa7d6d5493fbf3cc2bcbd90e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 7 Jun 2020 14:35:22 +0100 Subject: [PATCH] Remove duplicated post recipients --- posts.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/posts.py b/posts.py index d0b36ca43..7562430ff 100644 --- a/posts.py +++ b/posts.py @@ -678,6 +678,18 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int, } ] + # make sure that CC doesn't also contain a To address + # eg. To: [ "https://mydomain/users/foo/followers" ] + # CC: [ "X", "Y", "https://mydomain/users/foo", "Z" ] + removeFromCC = [] + for ccRecipient in toCC: + for sendToActor in toRecipients: + if ccRecipient in sendToActor: + if ccRecipient not in removeFromCC: + removeFromCC.append(ccRecipient) + for ccRemoval in removeFromCC: + toCC.remove(ccRemoval) + if not clientToServer: actorUrl = httpPrefix + '://' + domain + '/users/' + nickname