add subscribing and unsubscribing to threads

This commit is contained in:
2025-06-02 20:54:36 +03:00
parent 1e23959e52
commit bd1ba6c087
6 changed files with 94 additions and 22 deletions

View File

@ -105,13 +105,16 @@ function util.split_sentences(sentences, max_sentences)
end
---@return string
function util.get_post_url(req, post_id)
function util.get_post_url(req, post_id, hash)
hash = hash ~= false
local post = Posts:find({id = post_id})
if not post then return "" end
local thread = Threads:find({id = post.thread_id})
if not thread then return "" end
return req:url_for("thread", {slug = thread.slug}, {after = post_id}) .. "#post-" .. post_id
local url = req:url_for("thread", {slug = thread.slug}, {after = post_id})
if not hash then return url end
return url .. "#post-" .. post_id
end
function util.infobox_message(msg)