Skip to content

Commit

Permalink
move expandThreads into its own general purpose function
Browse files Browse the repository at this point in the history
  • Loading branch information
enkiv2 committed Jul 14, 2022
1 parent 07d9ff1 commit 8d5881c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fern
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,8 @@ def execCommand(cmd):
tlIdx+=len(toots)-1
elif cmd=="expand_notes":
notes=getTimeline("notifications")
statusMsg("Expanding "+str(len(notes))+" notifications...", False)
(tl, tlIdx, hlIdx) = ([], 0, 0)
for note in notes:
tl+=expandThread(note["id"])
tl=expandThreads(list(map(lambda x: x["id"], notes)))
elif cmd=="toggle_cw": isCWOpen=not isCWOpen
elif cmd=="set_timeline":
msg=queryForInput("Timeline name (blank for cancel, separate multiple timelines with spaces):")
Expand Down Expand Up @@ -576,6 +574,14 @@ def getTimeline(which=None, **kw_args):
saveBase()
return tl

def expandThreads(tids, verbose=False):
if verbose:
statusMsg("Expanding "+str(len(tids))+" threads...", False)
ret=[]
for tid in tids:
ret+=expandThread(tid, verbose)
return ret

def expandThread(tid, verbose=False):
if verbose:
statusMsg("Expanding thread...", False)
Expand Down

0 comments on commit 8d5881c

Please sign in to comment.