Use referer form data instead of relying on header
This commit is contained in:
@@ -11,34 +11,34 @@ proc renderMoreReplies(thread: Thread): VNode =
|
||||
a(class="more-replies-text", title="Not implemented yet"):
|
||||
text $num & "more " & reply
|
||||
|
||||
proc renderReplyThread(thread: Thread; prefs: Prefs): VNode =
|
||||
proc renderReplyThread(thread: Thread; prefs: Prefs; path: string): VNode =
|
||||
buildHtml(tdiv(class="reply thread thread-line")):
|
||||
for i, tweet in thread.content:
|
||||
let last = (i == thread.content.high and thread.more == 0)
|
||||
renderTweet(tweet, prefs, index=i, last=last)
|
||||
renderTweet(tweet, prefs, path, index=i, last=last)
|
||||
|
||||
if thread.more != 0:
|
||||
renderMoreReplies(thread)
|
||||
|
||||
proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode =
|
||||
proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string): VNode =
|
||||
let hasAfter = conversation.after != nil
|
||||
buildHtml(tdiv(class="conversation", id="posts")):
|
||||
tdiv(class="main-thread"):
|
||||
if conversation.before != nil:
|
||||
tdiv(class="before-tweet thread-line"):
|
||||
for i, tweet in conversation.before.content:
|
||||
renderTweet(tweet, prefs, index=i)
|
||||
renderTweet(tweet, prefs, path, index=i)
|
||||
|
||||
tdiv(class="main-tweet"):
|
||||
let afterClass = if hasAfter: "thread thread-line" else: ""
|
||||
renderTweet(conversation.tweet, prefs, class=afterClass)
|
||||
renderTweet(conversation.tweet, prefs, path, class=afterClass)
|
||||
|
||||
if hasAfter:
|
||||
tdiv(class="after-tweet thread-line"):
|
||||
let total = conversation.after.content.high
|
||||
let more = conversation.after.more
|
||||
for i, tweet in conversation.after.content:
|
||||
renderTweet(tweet, prefs, index=i, last=(i == total and more == 0))
|
||||
renderTweet(tweet, prefs, path, index=i, last=(i == total and more == 0))
|
||||
|
||||
if more != 0:
|
||||
renderMoreReplies(conversation.after)
|
||||
@@ -46,4 +46,5 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode =
|
||||
if conversation.replies.len > 0:
|
||||
tdiv(class="replies"):
|
||||
for thread in conversation.replies:
|
||||
renderReplyThread(thread, prefs)
|
||||
if thread == nil: continue
|
||||
renderReplyThread(thread, prefs, path)
|
||||
|
||||
Reference in New Issue
Block a user