some things
This commit is contained in:
@ -64,6 +64,10 @@ app:get("thread", "/:slug", function(self)
|
||||
return {status = 404}
|
||||
end
|
||||
self.thread = thread
|
||||
local post_count = Posts:count(db.clause({
|
||||
thread_id = thread.id
|
||||
}))
|
||||
local pages = math.floor(post_count / 20)
|
||||
local posts = db.query([[
|
||||
SELECT
|
||||
posts.id, post_history.content, users.username, avatars.file_path AS avatar_path
|
||||
@ -81,6 +85,7 @@ app:get("thread", "/:slug", function(self)
|
||||
posts.created_at ASC
|
||||
LIMIT 20
|
||||
]], thread.id, tonumber(self.params.cursor or 0))
|
||||
self.topic = Topics:find(thread.topic_id)
|
||||
self.user = util.get_logged_in_user_or_transient(self)
|
||||
self.posts = posts
|
||||
self.next_cursor = #posts > 0 and posts[#posts].id or nil
|
||||
|
Reference in New Issue
Block a user