Convert 'to' and 'cc' strings to lists

master
Bob Mottram 2019-08-16 18:51:00 +01:00
parent 1b1810ff8a
commit db3ecc9511
1 changed files with 20 additions and 4 deletions

View File

@ -379,11 +379,15 @@ def inboxPostRecipients(baseDir :str,postJsonObject :{},httpPrefix :str,domain :
if postJsonObject.get('object'): if postJsonObject.get('object'):
if isinstance(postJsonObject['object'], dict): if isinstance(postJsonObject['object'], dict):
if postJsonObject['object'].get('to'): if postJsonObject['object'].get('to'):
if isinstance(postJsonObject['object']['to'], list):
recipientsList=postJsonObject['object']['to']
else:
recipientsList=[postJsonObject['object']['to']]
if debug: if debug:
print('DEBUG: resolving "to"') print('DEBUG: resolving "to"')
includesFollowers,recipientsDict= \ includesFollowers,recipientsDict= \
inboxPostRecipientsAdd(baseDir,httpPrefix, \ inboxPostRecipientsAdd(baseDir,httpPrefix, \
postJsonObject['object']['to'], \ recipientsList, \
recipientsDict, \ recipientsDict, \
domainMatch,domainBase, \ domainMatch,domainBase, \
actor,debug) actor,debug)
@ -394,9 +398,13 @@ def inboxPostRecipients(baseDir :str,postJsonObject :{},httpPrefix :str,domain :
print('DEBUG: inbox post has no "to"') print('DEBUG: inbox post has no "to"')
if postJsonObject['object'].get('cc'): if postJsonObject['object'].get('cc'):
if isinstance(postJsonObject['object']['cc'], list):
recipientsList=postJsonObject['object']['cc']
else:
recipientsList=[postJsonObject['object']['cc']]
includesFollowers,recipientsDict= \ includesFollowers,recipientsDict= \
inboxPostRecipientsAdd(baseDir,httpPrefix, \ inboxPostRecipientsAdd(baseDir,httpPrefix, \
postJsonObject['object']['cc'], \ recipientsList, \
recipientsDict, \ recipientsDict, \
domainMatch,domainBase, \ domainMatch,domainBase, \
actor,debug) actor,debug)
@ -415,9 +423,13 @@ def inboxPostRecipients(baseDir :str,postJsonObject :{},httpPrefix :str,domain :
print('DEBUG: inbox item is a link to an actor') print('DEBUG: inbox item is a link to an actor')
if postJsonObject.get('to'): if postJsonObject.get('to'):
if isinstance(postJsonObject['to'], list):
recipientsList=postJsonObject['to']
else:
recipientsList=[postJsonObject['to']]
includesFollowers,recipientsDict= \ includesFollowers,recipientsDict= \
inboxPostRecipientsAdd(baseDir,httpPrefix, \ inboxPostRecipientsAdd(baseDir,httpPrefix, \
postJsonObject['to'], \ recipientsList, \
recipientsDict, \ recipientsDict, \
domainMatch,domainBase, \ domainMatch,domainBase, \
actor,debug) actor,debug)
@ -425,9 +437,13 @@ def inboxPostRecipients(baseDir :str,postJsonObject :{},httpPrefix :str,domain :
followerRecipients=True followerRecipients=True
if postJsonObject.get('cc'): if postJsonObject.get('cc'):
if isinstance(postJsonObject['cc'], list):
recipientsList=postJsonObject['cc']
else:
recipientsList=[postJsonObject['cc']]
includesFollowers,recipientsDict= \ includesFollowers,recipientsDict= \
inboxPostRecipientsAdd(baseDir,httpPrefix, \ inboxPostRecipientsAdd(baseDir,httpPrefix, \
postJsonObject['cc'], \ recipientsList, \
recipientsDict, \ recipientsDict, \
domainMatch,domainBase, \ domainMatch,domainBase, \
actor,debug) actor,debug)