fix: reply chain uses reply_to_id (UUID) instead of reply_to_username

- reply_to_id UUID FK: precise parent tracking (username was ambiguous
  when same user wrote multiple replies in a chain)
- GET /api/replies: JOIN replies + users to return reply_to_username
- POST /api/replies: accept reply_to_id (UUID) instead of reply_to_username
- Frontend depth calc: follow reply_to_id chain (not username)
- Preview bar: resolve username from local replies by ID
- Indicator scroll: target by data-reply-id
This commit is contained in:
lezi-fun committed 2026-08-11 21:38:45 +08:00
1 parent 59d5fb89c0
commit 6c100ff3a1
3 files changed
+22 -18

No files matched your search

+2 -2
View File
@@ -77,10 +77,10 @@ export const API = {
// 回复
getReplies(postId) { return apiFetch('/posts/' + postId + '/replies'); },
createReply(postId, content, captcha, replyToUsername) {
createReply(postId, content, captcha, replyToId) {
return apiFetch('/posts/' + postId + '/replies', {
method: 'POST',
body: JSON.stringify({ content, captcha_id: captcha?.id, captcha_answer: captcha?.answer, captcha_sig: captcha?.sig, reply_to_username: replyToUsername || null }),
body: JSON.stringify({ content, captcha_id: captcha?.id, captcha_answer: captcha?.answer, captcha_sig: captcha?.sig, reply_to_id: replyToId || null }),
});
},
deleteReply(replyId) { return apiFetch('/replies/' + replyId, { method: 'DELETE' }); },