Show profile for last read post

merge-requests/30/head
Bob Mottram 2021-03-23 16:17:03 +00:00
parent 7c58e89f0b
commit a2c95ba9af
1 changed files with 20 additions and 6 deletions

View File

@ -721,16 +721,18 @@ def _showProfile(session, nickname: str, domain: str,
pageNumber: int, index: int, boxJson: {}, pageNumber: int, index: int, boxJson: {},
systemLanguage: str, systemLanguage: str,
screenreader: str, espeak, screenreader: str, espeak,
translate: {}, yourActor: str) -> {}: translate: {}, yourActor: str,
postJsonObject: {}) -> {}:
"""Shows the profile of the actor for the given post """Shows the profile of the actor for the given post
Returns the actor json Returns the actor json
""" """
if _timelineIsEmpty(boxJson): if _timelineIsEmpty(boxJson):
return {} return {}
postJsonObject = _desktopGetBoxPostObject(boxJson, index)
if not postJsonObject: if not postJsonObject:
return {} postJsonObject = _desktopGetBoxPostObject(boxJson, index)
if not postJsonObject:
return {}
actor = None actor = None
if postJsonObject['type'] == 'Announce': if postJsonObject['type'] == 'Announce':
@ -1418,11 +1420,22 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
espeak, translate, yourActor) espeak, translate, yourActor)
print('') print('')
elif commandStr.startswith('profile ') or commandStr == 'profile': elif commandStr.startswith('profile ') or commandStr == 'profile':
actorJson = None
if commandStr == 'profile': if commandStr == 'profile':
postIndexStr = '1' if postJsonObject:
actorJson = \
_showProfile(session, nickname, domain,
httpPrefix, baseDir, currTimeline,
pageNumber, postIndex, boxJson,
systemLanguage, screenreader,
espeak, translate, yourActor,
postJsonObject)
else:
postIndexStr = '1'
else: else:
postIndexStr = commandStr.split('profile ')[1] postIndexStr = commandStr.split('profile ')[1]
if boxJson and postIndexStr.isdigit():
if not actorJson and boxJson and postIndexStr.isdigit():
_desktopShowBox(yourActor, currTimeline, boxJson, _desktopShowBox(yourActor, currTimeline, boxJson,
screenreader, systemLanguage, screenreader, systemLanguage,
espeak, pageNumber, espeak, pageNumber,
@ -1433,7 +1446,8 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
httpPrefix, baseDir, currTimeline, httpPrefix, baseDir, currTimeline,
pageNumber, postIndex, boxJson, pageNumber, postIndex, boxJson,
systemLanguage, screenreader, systemLanguage, screenreader,
espeak, translate, yourActor) espeak, translate, yourActor,
None)
print('') print('')
elif commandStr == 'reply' or commandStr == 'r': elif commandStr == 'reply' or commandStr == 'r':
if postJsonObject: if postJsonObject: