Use attachment index

merge-requests/30/head
Bob Mottram 2021-03-17 22:50:17 +00:00
parent a0b20fbf64
commit d3a42f862d
1 changed files with 8 additions and 9 deletions

View File

@ -127,22 +127,21 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
continue continue
if 'attachment' in actorJson: if 'attachment' in actorJson:
found = False found = False
ctr = 0 for attachIdx in range(len(actorJson['attachment'])):
for propertyValue in actorJson['attachment']: if actorJson['attachment'][attachIdx]['type'] != \
if propertyValue != 'PropertyValue': 'PropertyValue':
ctr += 1
continue continue
if propertyValue['name'] != newPropertyValue['name']: if actorJson['attachment'][attachIdx]['name'] != \
ctr += 1 newPropertyValue['name']:
continue continue
else: else:
if propertyValue['value'] != newPropertyValue['value']: if actorJson['attachment'][attachIdx]['value'] != \
actorJson['attachment'][ctr]['value'] = \ newPropertyValue['value']:
actorJson['attachment'][attachIdx]['value'] = \
newPropertyValue['value'] newPropertyValue['value']
actorChanged = True actorChanged = True
found = True found = True
break break
ctr += 1
if not found: if not found:
actorJson['attachment'].append({ actorJson['attachment'].append({
"name": newPropertyValue['name'], "name": newPropertyValue['name'],