Freshen branch, fix commenting

Handle a couple places with `t3_` that persisted from code movement.
on master after time of branch.

Then, fix commenting, which used inaccurate fullname parsing logic.
This commit is contained in:
TLSM 2023-07-13 01:40:23 -04:00
parent 5f50c58e5b
commit 75da44fd98
No known key found for this signature in database
GPG key ID: E745A82778055C7E
3 changed files with 5 additions and 6 deletions

View file

@ -111,16 +111,15 @@ def api_comment(v):
parent_fullname = request.values.get("parent_fullname", "").strip()
if len(parent_fullname) < 4: abort(400)
id = parent_fullname[3:]
parent = None
parent_post = None
parent_comment_id = None
if parent_fullname.startswith("post_"):
parent = get_post(id, v=v)
parent = get_post(parent_fullname.split("post_")[1], v=v)
parent_post = parent
elif parent_fullname.startswith("comment_"):
parent = get_comment(id, v=v)
parent = get_comment(parent_fullname.split("comment_")[1], v=v)
parent_post = get_post(parent.parent_submission, v=v) if parent.parent_submission else None
parent_comment_id = parent.id
else: abort(400)

View file

@ -1,10 +1,10 @@
<div id="reply-to-{{c.id}}" class="d-none">
<div id="comment-form-space-{{c.fullname}}" class="comment-write collapsed child">
<form id="reply-to-t3_{{c.id}}" action="/comment" method="post" enctype="multipart/form-data">
<form id="reply-to-{{c.fullname}}" action="/comment" method="post" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="parent_fullname" value="{{c.fullname}}">
<input autocomplete="off" id="reply-form-submission-{{c.fullname}}" type="hidden" name="submission" value="{{c.post.id}}">
<textarea required autocomplete="off" minlength="1" maxlength="{{COMMENT_BODY_LENGTH_MAXIMUM}}" oninput="markdown('reply-form-body-{{c.fullname}}', 'reply-edit-{{c.id}}');charLimit('reply-form-body-{{c.fullname}}','charcount-{{c.id}}')" id="reply-form-body-{{c.fullname}}" data-fullname="{{c.fullname}}" name="body" form="reply-to-t3_{{c.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<textarea required autocomplete="off" minlength="1" maxlength="{{COMMENT_BODY_LENGTH_MAXIMUM}}" oninput="markdown('reply-form-body-{{c.fullname}}', 'reply-edit-{{c.id}}');charLimit('reply-form-body-{{c.fullname}}','charcount-{{c.id}}')" id="reply-form-body-{{c.fullname}}" data-fullname="{{c.fullname}}" name="body" form="reply-to-{{c.fullname}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>

View file

@ -3,7 +3,7 @@
<div id="comment-form-space-{{c.id}}" class="comment-write collapsed child">
<form id="reply-to-message-{{c.id}}" action="/reply" method="post" class="input-group" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<textarea required autocomplete="off" minlength="1" maxlength="{{MESSAGE_BODY_LENGTH_MAXIMUM}}" name="body" form="reply-to-t3_{{c.id}}" data-id="{{c.id}}" class="comment-box form-control rounded" id="reply-form-body-{{c.id}}" aria-label="With textarea" rows="3" oninput="markdown('reply-form-body-{{c.id}}', 'message-reply-{{c.id}}')"></textarea>
<textarea required autocomplete="off" minlength="1" maxlength="{{MESSAGE_BODY_LENGTH_MAXIMUM}}" name="body" form="reply-to-message-{{c.id}}" data-id="{{c.id}}" class="comment-box form-control rounded" id="reply-form-body-{{c.id}}" aria-label="With textarea" rows="3" oninput="markdown('reply-form-body-{{c.id}}', 'message-reply-{{c.id}}')"></textarea>
<div class="comment-format" id="comment-format-bar-{{c.id}}">
{% if c.sentto == MODMAIL_ID %}
<label class="btn btn-secondary m-0 mt-3" for="file-upload">