From 68fe0ed4f8958439efdedf90fa9fb26c0a2dfb90 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 12 May 2021 19:31:41 +0100 Subject: [PATCH] Show occupation on profile screen --- daemon.py | 6 ++++-- webapp_profile.py | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/daemon.py b/daemon.py index ee039a1db..bee3c8291 100644 --- a/daemon.py +++ b/daemon.py @@ -4596,8 +4596,10 @@ class PubServer(BaseHTTPRequestHandler): if actorJson.get('occupationName'): occupationName = actorJson['occupationName'] if fields.get('occupationName'): - if actorJson['occupationName'] != fields['occupationName']: - actorJson['occupationName'] = fields['occupationName'] + if actorJson['occupationName'] != \ + fields['occupationName']: + actorJson['occupationName'] = \ + fields['occupationName'] actorChanged = True else: if occupationName: diff --git a/webapp_profile.py b/webapp_profile.py index cfc61ec9a..e5b569978 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -343,7 +343,8 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, alsoKnownAs: [], pinnedContent: str, accessKeys: {}, - joinedDate: str) -> str: + joinedDate: str, + occupationName: str) -> str: """The header of the profile screen, containing background image and avatar """ @@ -362,7 +363,14 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, translate['Switch to timeline view'] + '">\n' + \ ' \n' - htmlStr += '

' + displayName + '

\n' + + occupationStr = '' + if occupationName: + occupationStr += \ + ' ' + occupationName + '
\n' + + htmlStr += '

' + displayName + '

\n' + occupationStr + htmlStr += \ '

@' + nickname + '@' + domainFull + '
\n' if joinedDate: @@ -731,6 +739,9 @@ def htmlProfile(rssIconAtTop: bool, if profileJson.get('published'): if 'T' in profileJson['published']: joinedDate = profileJson['published'] + occupationName = None + if profileJson.get('occupationName'): + occupationName = profileJson['occupationName'] avatarUrl = profileJson['icon']['url'] @@ -752,7 +763,7 @@ def htmlProfile(rssIconAtTop: bool, loginButton, avatarUrl, theme, movedTo, alsoKnownAs, pinnedContent, accessKeys, - joinedDate) + joinedDate, occupationName) # keyboard navigation userPathStr = '/users/' + nickname