diff --git a/app/post/routes.py b/app/post/routes.py index 685567d9..dee6a2b9 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -423,6 +423,7 @@ def continue_discussion(post_id, comment_id): @bp.route('/post//comment//reply', methods=['GET', 'POST']) @login_required def add_reply(post_id: int, comment_id: int): + # this route is used when JS is disabled if current_user.banned or current_user.ban_comments: return show_ban_message() post = Post.query.get_or_404(post_id) @@ -477,6 +478,8 @@ def add_reply(post_id: int, comment_id: int): @bp.route('/post//comment//reply_inline', methods=['GET', 'POST']) @login_required def add_reply_inline(post_id: int, comment_id: int): + # this route is called by htmx and returns a html fragment representing a form that can be submitted to make a new reply + # it also accepts the POST from that form and makes the reply if current_user.banned or current_user.ban_comments: return _('You have been banned.') post = Post.query.get_or_404(post_id) diff --git a/app/templates/post/add_reply_inline_result.html b/app/templates/post/add_reply_inline_result.html index d699c91f..9b45d234 100644 --- a/app/templates/post/add_reply_inline_result.html +++ b/app/templates/post/add_reply_inline_result.html @@ -1,5 +1,8 @@ {# This file is similar to _post_reply_teaser.html except it includes the render_username macro and removes - a few things that aren't needed on brand new comments #} + a few things that aren't needed on brand new comments. + We need to include that macro because this template is used as part of a full page (it's an ajax response) so + it does not inherit from base.html where the macro is normally defined. +#} {% macro render_username(user, add_domain=True, htmx_redirect_back_to=None) -%} {% if user.deleted -%}