Explorar el Código

Workaround for Twitter bug

For some reason, reply threads with only "unavailable" tweets get the tag
`ThreadedConversation--selfThread`, which is only meant to be used for replies
that are actually part of the thread you're viewing. To fix this we simply only
check "self" for the first reply.
Zed hace 7 años
padre
commit
7ef10b88f4
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/parser.nim

+ 2 - 2
src/parser.nim

@@ -102,11 +102,11 @@ proc parseConversation*(node: XmlNode): Conversation =
   let replies = node.select(".replies-to .stream-items")
   let replies = node.select(".replies-to .stream-items")
   if replies == nil: return
   if replies == nil: return
 
 
-  for reply in replies.filterIt(it.kind != xnText):
+  for i, reply in replies.filterIt(it.kind != xnText):
     let class = reply.attr("class").toLower()
     let class = reply.attr("class").toLower()
     let thread = reply.select(".stream-items")
     let thread = reply.select(".stream-items")
 
 
-    if "self" in class:
+    if i == 0 and "self" in class:
       result.after = parseThread(thread)
       result.after = parseThread(thread)
     elif "lone" in class:
     elif "lone" in class:
       result.replies.add parseThread(reply)
       result.replies.add parseThread(reply)