Profile command can use handle

main
Bob Mottram 2021-03-25 12:57:01 +00:00
parent 6f7bc84780
commit 96b36e81a9
2 changed files with 35 additions and 3 deletions

View File

@ -473,7 +473,7 @@ next Next page in the timeline
prev Previous page in the timeline
read [post number] Read a post from a timeline
open [post number] Open web links within a timeline post
profile [post number] Show profile for the person who made the given post
profile [post number or handle] Show profile for the person who made the given post
following [page number] Show accounts that you are following
followers [page number] Show accounts that are following you
approve [handle] Approve a follow request

View File

@ -113,7 +113,7 @@ def _desktopHelp() -> None:
'Read a post from a timeline')
print(indent + 'open [post number] ' +
'Open web links within a timeline post')
print(indent + 'profile [post number] ' +
print(indent + 'profile [post number or handle] ' +
'Show profile for the person who made the given post')
print(indent + 'following [page number] ' +
'Show accounts that you are following')
@ -836,6 +836,24 @@ def _desktopShowProfile(session, nickname: str, domain: str,
return actorJson
def _desktopShowProfileFromHandle(session, nickname: str, domain: str,
httpPrefix: str, baseDir: str, boxName: str,
handle: str,
systemLanguage: str,
screenreader: str, espeak,
translate: {}, yourActor: str,
postJsonObject: {}) -> {}:
"""Shows the profile for a handle
Returns the actor json
"""
actorJson = getActorJson(handle, False, False, False, True)
_desktopShowActor(baseDir, actorJson, translate,
systemLanguage, screenreader, espeak)
return actorJson
def _desktopGetBoxPostObject(boxJson: {}, index: int) -> {}:
"""Gets the post with the given index from the timeline
"""
@ -1581,7 +1599,21 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
else:
postIndexStr = commandStr.split('profile ')[1]
if not actorJson and boxJson and postIndexStr.isdigit():
if not postIndexStr.isdigit():
profileHandle = postIndexStr
_desktopShowBox(indent, followRequestsJson,
yourActor, currTimeline, boxJson,
translate,
screenreader, systemLanguage,
espeak, pageNumber,
newRepliesExist, newDMsExist)
_desktopShowProfileFromHandle(session, nickname, domain,
httpPrefix, baseDir,
currTimeline, profileHandle,
systemLanguage, screenreader,
espeak, translate, yourActor,
None)
elif not actorJson and boxJson:
_desktopShowBox(indent, followRequestsJson,
yourActor, currTimeline, boxJson,
translate,