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
|
||||
|
@ -62,9 +62,7 @@ app:get("topic", "/:slug", function(self)
|
||||
return {status = 404}
|
||||
end
|
||||
self.topic = topic
|
||||
self.threads_list = Threads:select(db.clause({
|
||||
topic_id = topic.id
|
||||
}))
|
||||
self.threads_list = db.query("SELECT * FROM threads WHERE topic_id = ? ORDER BY is_stickied DESC, created_at DESC", topic.id)
|
||||
local user = util.get_logged_in_user_or_transient(self)
|
||||
print(topic.is_locked, type(topic.is_locked))
|
||||
self.user = user
|
||||
|
Reference in New Issue
Block a user