Use attachment index

This commit is contained in:
bashrc committed 2021-03-17 22:50:17 +00:00
1 parent a0b20fbf64
commit d3a42f862d
1 file changed
+8 -9
+8 -9
View File
@@ -127,22 +127,21 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
continue
if 'attachment' in actorJson:
found = False
ctr = 0
for propertyValue in actorJson['attachment']:
if propertyValue != 'PropertyValue':
ctr += 1
for attachIdx in range(len(actorJson['attachment'])):
if actorJson['attachment'][attachIdx]['type'] != \
'PropertyValue':
continue
if propertyValue['name'] != newPropertyValue['name']:
ctr += 1
if actorJson['attachment'][attachIdx]['name'] != \
newPropertyValue['name']:
continue
else:
if propertyValue['value'] != newPropertyValue['value']:
actorJson['attachment'][ctr]['value'] = \
if actorJson['attachment'][attachIdx]['value'] != \
newPropertyValue['value']:
actorJson['attachment'][attachIdx]['value'] = \
newPropertyValue['value']
actorChanged = True
found = True
break
ctr += 1
if not found:
actorJson['attachment'].append({
"name": newPropertyValue['name'],