Webfinger removal based upon alias

main
Bob Mottram 2021-07-06 14:17:38 +01:00
parent 0c8b0964d7
commit 7863e0f99c
1 changed files with 10 additions and 10 deletions

View File

@ -272,8 +272,8 @@ def _webfingerUpdateFromProfile(wfJson: {}, actorJson: {}) -> bool:
} }
aliasesNotFound = [] aliasesNotFound = []
for name, _ in webfingerPropertyName.items(): for name, alias in webfingerPropertyName.items():
aliasesNotFound.append(name) aliasesNotFound.append(alias)
for propertyValue in actorJson['attachment']: for propertyValue in actorJson['attachment']:
if not propertyValue.get('name'): if not propertyValue.get('name'):
@ -282,8 +282,8 @@ def _webfingerUpdateFromProfile(wfJson: {}, actorJson: {}) -> bool:
found = False found = False
for name, alias in webfingerPropertyName.items(): for name, alias in webfingerPropertyName.items():
if name == propertyName: if name == propertyName:
if name in aliasesNotFound: if alias in aliasesNotFound:
aliasesNotFound.remove(name) aliasesNotFound.remove(alias)
found = True found = True
break break
if not found: if not found:
@ -317,12 +317,12 @@ def _webfingerUpdateFromProfile(wfJson: {}, actorJson: {}) -> bool:
# remove any aliases which are no longer in the actor profile # remove any aliases which are no longer in the actor profile
removeAlias = [] removeAlias = []
for name in aliasesNotFound: for alias in aliasesNotFound:
for alias in wfJson['aliases']: for fullAlias in wfJson['aliases']:
if alias.startswith(name + ':'): if fullAlias.startswith(alias + ':'):
removeAlias.append(alias) removeAlias.append(fullAlias)
for alias in removeAlias: for fullAlias in removeAlias:
wfJson['aliases'].remove(alias) wfJson['aliases'].remove(fullAlias)
changed = True changed = True
return changed return changed