Hide "Replying to" in threads when appropriate

This commit is contained in:
Zed 2019-07-02 01:01:27 +02:00
parent a67d27e0c4
commit f378eedcc8
2 changed files with 7 additions and 6 deletions

View File

@ -155,7 +155,7 @@
</div> </div>
#end proc #end proc
# #
#proc renderTweet*(tweet: Tweet; class=""; last=false): string = #proc renderTweet*(tweet: Tweet; class=""; first=true; last=false): string =
#var divClass = if last: "thread-last " & class else: class #var divClass = if last: "thread-last " & class else: class
#if divClass.len > 0: #if divClass.len > 0:
<div class="${divClass}"> <div class="${divClass}">
@ -164,7 +164,7 @@
<div class="status-el"> <div class="status-el">
<div class="status-body"> <div class="status-body">
${renderHeading(tweet)} ${renderHeading(tweet)}
#if tweet.reply.len > 0: #if first and tweet.reply.len > 0:
${renderReply(tweet)} ${renderReply(tweet)}
#end if #end if
<div class="status-content-wrapper"> <div class="status-content-wrapper">

View File

@ -106,8 +106,8 @@
<div class="main-thread"> <div class="main-thread">
#if conversation.before.tweets.len > 0: #if conversation.before.tweets.len > 0:
<div class="before-tweet thread-line"> <div class="before-tweet thread-line">
#for tweet in conversation.before.tweets: #for i, tweet in conversation.before.tweets:
${renderTweet(tweet)} ${renderTweet(tweet, first=(i == 0))}
#end for #end for
</div> </div>
#end if #end if
@ -118,7 +118,7 @@
#if conversation.after.tweets.len > 0: #if conversation.after.tweets.len > 0:
<div class="after-tweet thread-line"> <div class="after-tweet thread-line">
#for i, tweet in conversation.after.tweets: #for i, tweet in conversation.after.tweets:
${renderTweet(tweet, last=(i == conversation.after.tweets.high))} ${renderTweet(tweet, first=(i == 0), last=(i == conversation.after.tweets.high))}
#end for #end for
</div> </div>
#end if #end if
@ -128,7 +128,8 @@
#for thread in conversation.replies: #for thread in conversation.replies:
<div class="reply thread thread-line"> <div class="reply thread thread-line">
#for i, tweet in thread.tweets: #for i, tweet in thread.tweets:
${renderTweet(tweet, last=(i == thread.tweets.high and thread.more == 0))} #let last = (i == thread.tweets.high and thread.more == 0)
${renderTweet(tweet, first=(i == 0), last=last)}
#end for #end for
#if thread.more != 0: #if thread.more != 0:
#let num = if thread.more != -1: $thread.more & " " else: "" #let num = if thread.more != -1: $thread.more & " " else: ""