Skip to content

Commit

Permalink
move thread expansion down to the cache control section
Browse files Browse the repository at this point in the history
  • Loading branch information
enkiv2 committed Jul 14, 2022
1 parent 758ead0 commit 07d9ff1
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions fern
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,6 @@ def execCommand(cmd):
tlIdx=tootsPerPage*int(position/tootsPerPage)
if(hlIdx+tlIdx>=len(tl)): hlIdx+=((hlIdx+tlIdx)-len(tl))

def expandThread(tid, verbose=False):
if verbose:
statusMsg("Expanding thread...", False)
ensureCached(tid)
while tootbase[tid]["in_reply_to_id"]!=None:
if verbose:
statusMsg("Expanding thread... (ID "+str(tid)+")", False)
tid=tootbase[tid]["in_reply_to_id"]
ensureCached(tid)
toots=[tootbase[tid]]
toots.extend(ensureCached(mastodon.status_context(tid)["descendants"], True))
saveBase()
return toots

######################### MASTODON & CACHE HANDLING
def getTimeline(which=None, **kw_args):
Expand All @@ -589,6 +576,20 @@ def getTimeline(which=None, **kw_args):
saveBase()
return tl

def expandThread(tid, verbose=False):
if verbose:
statusMsg("Expanding thread...", False)
ensureCached(tid)
while tootbase[tid]["in_reply_to_id"]!=None:
if verbose:
statusMsg("Expanding thread... (ID "+str(tid)+")", False)
tid=tootbase[tid]["in_reply_to_id"]
ensureCached(tid)
toots=[tootbase[tid]]
toots.extend(ensureCached(mastodon.status_context(tid)["descendants"], True))
saveBase()
return toots

def ensureCachedAcct(acct, verbose=False, ignoreErrors=True, msg=None, force=False):
myMsg="fetching account ID"
if msg:
Expand Down

0 comments on commit 07d9ff1

Please sign in to comment.