mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
inline commenting - explanatory comments
This commit is contained in:
parent
d8c4826ff6
commit
0349128be1
2 changed files with 7 additions and 1 deletions
|
@ -423,6 +423,7 @@ def continue_discussion(post_id, comment_id):
|
||||||
@bp.route('/post/<int:post_id>/comment/<int:comment_id>/reply', methods=['GET', 'POST'])
|
@bp.route('/post/<int:post_id>/comment/<int:comment_id>/reply', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def add_reply(post_id: int, comment_id: int):
|
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:
|
if current_user.banned or current_user.ban_comments:
|
||||||
return show_ban_message()
|
return show_ban_message()
|
||||||
post = Post.query.get_or_404(post_id)
|
post = Post.query.get_or_404(post_id)
|
||||||
|
@ -477,6 +478,8 @@ def add_reply(post_id: int, comment_id: int):
|
||||||
@bp.route('/post/<int:post_id>/comment/<int:comment_id>/reply_inline', methods=['GET', 'POST'])
|
@bp.route('/post/<int:post_id>/comment/<int:comment_id>/reply_inline', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def add_reply_inline(post_id: int, comment_id: int):
|
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:
|
if current_user.banned or current_user.ban_comments:
|
||||||
return _('You have been banned.')
|
return _('You have been banned.')
|
||||||
post = Post.query.get_or_404(post_id)
|
post = Post.query.get_or_404(post_id)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{# This file is similar to _post_reply_teaser.html except it includes the render_username macro and removes
|
{# 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) -%}
|
{% macro render_username(user, add_domain=True, htmx_redirect_back_to=None) -%}
|
||||||
<span class="render_username">
|
<span class="render_username">
|
||||||
{% if user.deleted -%}
|
{% if user.deleted -%}
|
||||||
|
|
Loading…
Add table
Reference in a new issue