Display unavailable quotes

This commit is contained in:
Zed 2019-07-04 04:38:23 +02:00
parent 8773fd901b
commit b708c78c42
4 changed files with 14 additions and 0 deletions

View file

@ -770,6 +770,10 @@ video {
background-color: #121212; background-color: #121212;
} }
.unavailable-quote {
padding: 8px;
}
.quote { .quote {
margin-top: 10px; margin-top: 10px;
border: solid 1px #404040; border: solid 1px #404040;

View file

@ -45,6 +45,7 @@ proc parseQuote*(quote: XmlNode): Quote =
text: getQuoteText(quote), text: getQuoteText(quote),
reply: parseTweetReply(quote), reply: parseTweetReply(quote),
hasThread: quote.select(".self-thread-context") != nil, hasThread: quote.select(".self-thread-context") != nil,
available: true
) )
result.profile = Profile( result.profile = Profile(
@ -85,6 +86,8 @@ proc parseTweet*(node: XmlNode): Tweet =
let quote = tweet.select(".QuoteTweet-innerContainer") let quote = tweet.select(".QuoteTweet-innerContainer")
if quote != nil: if quote != nil:
result.quote = some(parseQuote(quote)) result.quote = some(parseQuote(quote))
elif tweet.select(".Tombstone") != nil:
result.quote = some(Quote())
proc parseThread*(nodes: XmlNode): Thread = proc parseThread*(nodes: XmlNode): Thread =
if nodes == nil: return if nodes == nil: return

View file

@ -76,6 +76,7 @@ type
reply*: seq[string] reply*: seq[string]
hasThread*: bool hasThread*: bool
sensitive*: bool sensitive*: bool
available*: bool
thumb*: string thumb*: string
badge*: string badge*: string

View file

@ -119,6 +119,12 @@
# #
#proc renderQuote(quote: Quote): string = #proc renderQuote(quote: Quote): string =
#let hasMedia = quote.thumb.len > 0 or quote.sensitive #let hasMedia = quote.thumb.len > 0 or quote.sensitive
#if not quote.available:
<div class="quote unavailable">
<div class="unavailable-quote">This tweet is unavailable</div>
</div>
#return
#end if
<div class="quote"> <div class="quote">
<div class="quote-container"> <div class="quote-container">
<a class="quote-link" href="${getLink(quote)}"></a> <a class="quote-link" href="${getLink(quote)}"></a>