Changeset d41f4be in Klonkt


Ignore:
Timestamp:
06/21/2026 06:24:46 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
c9c6a2d
Parents:
49f698b
Message:

fix(reacties): can now also reply to a reply (not just top-level comments)

The backend already supported this (resolvedParent flattens to the top-level
thread), but the view only showed a Reply button + form on top-level comments.
Replies now also get a Reply button + inline form (user && canMutate); the reply
lands in the same thread (1 level deep preserved). Existing toggle JS picks up
the new .comment-reply-btn automatically.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/post.ejs

    r49f698b rd41f4be  
    154154                        <div class="comment-content"><%= r.content %></div>
    155155                        <div class="comment-actions">
     156                          <% if (user && canMutate) { %>
     157                            <button type="button" class="comment-reply-btn" data-reply-to="<%= r.id %>"><%= t('comments.reply') %></button>
     158                          <% } %>
    156159                          <% if (user && permissions.canDeleteComment(user, r, site)) { %>
    157160                            <form method="post" action="<%= _base %>/comments/<%= r.id %>/delete" style="display:inline" onsubmit="return confirm('<%= t('comments.delete_confirm') %>')">
     
    160163                          <% } %>
    161164                        </div>
     165
     166                        <%# Reageren op een antwoord — landt (via resolvedParent op de
     167                            server) in dezelfde thread, dus 1 niveau diep blijft behouden. %>
     168                        <% if (user && canMutate) { %>
     169                          <form method="post" action="<%= _base %>/comments" class="comment-reply-form" hidden data-reply-form-for="<%= r.id %>">
     170                            <input type="hidden" name="post_slug" value="<%= post.slug %>">
     171                            <input type="hidden" name="parent_comment_id" value="<%= r.id %>">
     172                            <textarea name="content" rows="3" maxlength="4000" placeholder="<%= t('comments.reply_to', { name: r.author_username }) %>" required></textarea>
     173                            <div class="comment-reply-form-actions">
     174                              <button type="submit" class="btn btn-primary"><%= t('comments.reply') %></button>
     175                              <button type="button" class="btn comment-cancel-reply"><%= t('comments.cancel') %></button>
     176                            </div>
     177                          </form>
     178                        <% } %>
    162179                      </div>
    163180                    </li>
Note: See TracChangeset for help on using the changeset viewer.