finish that a tag in topics view

This commit is contained in:
2025-08-11 17:46:22 +03:00
parent 712782bc1c
commit a0c86f33b4
3 changed files with 22 additions and 1 deletions

View File

@ -13,6 +13,20 @@ import time
bp = Blueprint("threads", __name__, url_prefix = "/threads/")
def get_post_url(post_id, _anchor=False):
post = Posts.find({'id': post_id})
if not post:
return ""
thread = Threads.find({'id': post.thread_id})
res = url_for('threads.thread', slug=thread.slug, after=post_id)
if not _anchor:
return res
return f"{res}#post-{post_id}"
@bp.get("/<slug>")
def thread(slug):
POSTS_PER_PAGE = 10