Don't remove mentions for public posts

merge-requests/30/head
Bob Mottram 2021-12-06 18:11:17 +00:00
parent 85a41dbbb1
commit 04e7addaf7
1 changed files with 21 additions and 20 deletions

View File

@ -1446,26 +1446,27 @@ def _createPostBase(baseDir: str,
postContext = getIndividualPostContext() postContext = getIndividualPostContext()
# make sure that CC doesn't also contain a To address if not isPublic:
# eg. To: [ "https://mydomain/users/foo/followers" ] # make sure that CC doesn't also contain a To address
# CC: [ "X", "Y", "https://mydomain/users/foo", "Z" ] # eg. To: [ "https://mydomain/users/foo/followers" ]
removeFromCC = [] # CC: [ "X", "Y", "https://mydomain/users/foo", "Z" ]
for ccRecipient in toCC: removeFromCC = []
for sendToActor in toRecipients: for ccRecipient in toCC:
if ccRecipient in sendToActor and \ for sendToActor in toRecipients:
ccRecipient not in removeFromCC: if ccRecipient in sendToActor and \
removeFromCC.append(ccRecipient) ccRecipient not in removeFromCC:
break removeFromCC.append(ccRecipient)
for ccRemoval in removeFromCC: break
toCC.remove(ccRemoval) for ccRemoval in removeFromCC:
toCC.remove(ccRemoval)
if inReplyTo and isPublic: else:
# If this is a public post then get the actor being if inReplyTo:
# replied to end ensure that it is within the CC list # If this is a public post then get the actor being
replyActor = getActorFromInReplyTo(inReplyTo) # replied to end ensure that it is within the CC list
if replyActor: replyActor = getActorFromInReplyTo(inReplyTo)
if replyActor not in toCC: if replyActor:
toCC.append(replyActor) if replyActor not in toCC:
toCC.append(replyActor)
# the type of post to be made # the type of post to be made
postObjectType = 'Note' postObjectType = 'Note'