Profile update

master
Bob Mottram 2019-08-20 21:35:15 +01:00
parent e0d9715629
commit 61f66545a3
1 changed files with 22 additions and 13 deletions

View File

@ -1319,20 +1319,29 @@ def sendToNamedAddresses(session,baseDir: str, \
return return
if not postJsonObject.get('object'): if not postJsonObject.get('object'):
return return
if isinstance(postJsonObject['object'], dict): if isinstance(postJsonObject['object'], dict):
if not postJsonObject['object'].get('to'): isProfileUpdate=False
if debug: # for actor updates there is no 'to' within the object
pprint(postJsonObject) if postJsonObject['object'].get('type') and postJsonObject.get('type'):
print('DEBUG: no "to" field when sending to named addresses') if postJsonObject['type']=='Update' and postJsonObject['object']['type']=='Person':
if postJsonObject['object'].get('type'): # use the original object, which has a 'to'
if postJsonObject['object']['type']=='Follow': recipientsObject=postJsonObject
if isinstance(postJsonObject['object']['object'], str): isProfileUpdate=True
if debug:
print('DEBUG: "to" field assigned to Follow') if not isProfileUpdate:
postJsonObject['object']['to']=[postJsonObject['object']['object']]
if not postJsonObject['object'].get('to'): if not postJsonObject['object'].get('to'):
return if debug:
recipientsObject=postJsonObject['object'] pprint(postJsonObject)
print('DEBUG: no "to" field when sending to named addresses')
if postJsonObject['object'].get('type'):
if postJsonObject['object']['type']=='Follow':
if isinstance(postJsonObject['object']['object'], str):
if debug:
print('DEBUG: "to" field assigned to Follow')
postJsonObject['object']['to']=[postJsonObject['object']['object']]
if not postJsonObject['object'].get('to'):
return
recipientsObject=postJsonObject['object']
else: else:
postJsonObject,fieldAdded=addToField('Follow',postJsonObject,debug) postJsonObject,fieldAdded=addToField('Follow',postJsonObject,debug)
if not fieldAdded: if not fieldAdded: