add responding to thread
This commit is contained in:
@ -52,6 +52,24 @@ def thread(slug):
|
||||
)
|
||||
|
||||
|
||||
@bp.post("/<slug>")
|
||||
@login_required
|
||||
def reply(slug):
|
||||
thread = Threads.find({"slug": slug})
|
||||
if not thread:
|
||||
return "no"
|
||||
user = get_active_user()
|
||||
if user.is_guest():
|
||||
return "no"
|
||||
if thread.locked() and not user.is_mod():
|
||||
return "no"
|
||||
|
||||
post_content = request.form['post_content']
|
||||
post = create_post(thread.id, user.id, post_content)
|
||||
|
||||
return redirect(url_for(".thread", slug=slug, after=post.id, _anchor="latest-post"))
|
||||
|
||||
|
||||
@bp.get("/create")
|
||||
@login_required
|
||||
def create():
|
||||
|
Reference in New Issue
Block a user