Sfoglia il codice sorgente

Fix "more replies" link for unavailable tweets

Zed 7 anni fa
parent
commit
7e713e8fa5
2 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 1 0
      src/formatters.nim
  2. 7 2
      src/views/status.nim

+ 1 - 0
src/formatters.nim

@@ -131,6 +131,7 @@ proc getRfc822Time*(tweet: Tweet): string =
   tweet.time.format("ddd', 'd MMM yyyy HH:mm:ss 'GMT'")
 
 proc getLink*(tweet: Tweet | Quote): string =
+  if tweet.id.len == 0: return
   &"/{tweet.profile.username}/status/{tweet.id}"
 
 proc getTombstone*(text: string): string =

+ 7 - 2
src/views/status.nim

@@ -6,9 +6,14 @@ import tweet, timeline
 proc renderMoreReplies(thread: Thread): VNode =
   let num = if thread.more != -1: $thread.more & " " else: ""
   let reply = if thread.more == 1: "reply" else: "replies"
+  let link = getLink(thread.content[0])
   buildHtml(tdiv(class="timeline-item more-replies")):
-    a(class="more-replies-text", href=getLink(thread.content[0])):
-      text $num & "more " & reply
+    if link.len > 0:
+      a(class="more-replies-text", href=getLink(thread.content[0])):
+        text $num & "more " & reply
+    else:
+      a(class="more-replies-text"):
+        text $num & "more " & reply
 
 proc renderReplyThread(thread: Thread; prefs: Prefs; path: string): VNode =
   buildHtml(tdiv(class="reply thread thread-line")):