From b708c78c42c94ae4798f3a8ae0f17c0c11ee990b Mon Sep 17 00:00:00 2001 From: Zed Date: Thu, 4 Jul 2019 04:38:23 +0200 Subject: [PATCH] Display unavailable quotes --- public/style.css | 4 ++++ src/parser.nim | 3 +++ src/types.nim | 1 + src/views/tweet.nimf | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/public/style.css b/public/style.css index ce59d64..5bf9cd2 100644 --- a/public/style.css +++ b/public/style.css @@ -770,6 +770,10 @@ video { background-color: #121212; } +.unavailable-quote { + padding: 8px; +} + .quote { margin-top: 10px; border: solid 1px #404040; diff --git a/src/parser.nim b/src/parser.nim index b57b4f7..431231d 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -45,6 +45,7 @@ proc parseQuote*(quote: XmlNode): Quote = text: getQuoteText(quote), reply: parseTweetReply(quote), hasThread: quote.select(".self-thread-context") != nil, + available: true ) result.profile = Profile( @@ -85,6 +86,8 @@ proc parseTweet*(node: XmlNode): Tweet = let quote = tweet.select(".QuoteTweet-innerContainer") if quote != nil: result.quote = some(parseQuote(quote)) + elif tweet.select(".Tombstone") != nil: + result.quote = some(Quote()) proc parseThread*(nodes: XmlNode): Thread = if nodes == nil: return diff --git a/src/types.nim b/src/types.nim index 710dd62..76ec42a 100644 --- a/src/types.nim +++ b/src/types.nim @@ -76,6 +76,7 @@ type reply*: seq[string] hasThread*: bool sensitive*: bool + available*: bool thumb*: string badge*: string diff --git a/src/views/tweet.nimf b/src/views/tweet.nimf index bfb1899..630bc09 100644 --- a/src/views/tweet.nimf +++ b/src/views/tweet.nimf @@ -119,6 +119,12 @@ # #proc renderQuote(quote: Quote): string = #let hasMedia = quote.thumb.len > 0 or quote.sensitive +#if not quote.available: +
+
This tweet is unavailable
+
+#return +#end if