mirror of https://gitlab.com/bashrc2/epicyon
More standard occupation property
parent
4a49ec40e1
commit
0f0818994e
|
@ -4593,19 +4593,20 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# Other accounts (alsoKnownAs)
|
# Other accounts (alsoKnownAs)
|
||||||
occupationName = ""
|
occupationName = ""
|
||||||
if actorJson.get('occupationName'):
|
if actorJson.get('hasOccupation'):
|
||||||
occupationName = actorJson['occupationName']
|
if actorJson['hasOccupation'].get('name'):
|
||||||
|
occupationName = actorJson['hasOccupation']['name']
|
||||||
if fields.get('occupationName'):
|
if fields.get('occupationName'):
|
||||||
fields['occupationName'] = \
|
fields['occupationName'] = \
|
||||||
removeHtml(fields['occupationName'])
|
removeHtml(fields['occupationName'])
|
||||||
if occupationName != \
|
if occupationName != \
|
||||||
fields['occupationName']:
|
fields['occupationName']:
|
||||||
actorJson['occupationName'] = \
|
actorJson['hasOccupation']['name'] = \
|
||||||
fields['occupationName']
|
fields['occupationName']
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
else:
|
else:
|
||||||
if occupationName:
|
if occupationName:
|
||||||
actorJson['occupationName'] = ''
|
actorJson['hasOccupation']['name'] = ''
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
|
|
||||||
# Other accounts (alsoKnownAs)
|
# Other accounts (alsoKnownAs)
|
||||||
|
|
28
person.py
28
person.py
|
@ -219,7 +219,8 @@ def getDefaultPersonContext() -> str:
|
||||||
'schema': 'http://schema.org#',
|
'schema': 'http://schema.org#',
|
||||||
'suspended': 'toot:suspended',
|
'suspended': 'toot:suspended',
|
||||||
'toot': 'http://joinmastodon.org/ns#',
|
'toot': 'http://joinmastodon.org/ns#',
|
||||||
'value': 'schema:value'
|
'value': 'schema:value',
|
||||||
|
'Occupation': 'schema:Occupation'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,7 +297,11 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
'tts': personId + '/speaker',
|
'tts': personId + '/speaker',
|
||||||
'shares': personId + '/shares',
|
'shares': personId + '/shares',
|
||||||
'orgSchema': None,
|
'orgSchema': None,
|
||||||
'occupation': "",
|
'hasOccupation': {
|
||||||
|
'@type': 'Occupation',
|
||||||
|
'name': "",
|
||||||
|
'skills': "",
|
||||||
|
},
|
||||||
'skills': {},
|
'skills': {},
|
||||||
'roles': {},
|
'roles': {},
|
||||||
'availability': None,
|
'availability': None,
|
||||||
|
@ -578,7 +583,26 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
personJson['published'] = published
|
personJson['published'] = published
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
||||||
|
occupationName = ''
|
||||||
|
if personJson.get('occupation'):
|
||||||
|
occupationName = personJson['occupation']
|
||||||
|
del personJson['occupation']
|
||||||
|
|
||||||
|
if not personJson.get('hasOccupation'):
|
||||||
|
personJson['hasOccupation'] = {
|
||||||
|
'@type': 'Occupation',
|
||||||
|
'name': occupationName,
|
||||||
|
'skills': "",
|
||||||
|
},
|
||||||
|
updateActor = True
|
||||||
|
|
||||||
if updateActor:
|
if updateActor:
|
||||||
|
personJson['@context'] = [
|
||||||
|
'https://www.w3.org/ns/activitystreams',
|
||||||
|
'https://w3id.org/security/v1',
|
||||||
|
getDefaultPersonContext()
|
||||||
|
],
|
||||||
|
|
||||||
saveJson(personJson, filename)
|
saveJson(personJson, filename)
|
||||||
|
|
||||||
# also update the actor within the cache
|
# also update the actor within the cache
|
||||||
|
|
Loading…
Reference in New Issue