Skip to content

Conversation

@PBnicad
Copy link
Contributor

@PBnicad PBnicad commented Jan 16, 2026

📋 Summary

Implements nested comment reply functionality as requested in #161.

✨ Features

  • Two-level comment nesting: Users can reply to both root comments and replies
  • Reply input component: Dedicated UI for replying to comments with cancel button
  • @username mentions: When displaying a reply, shows @username to indicate who is being replied to
  • Click outside to close: Reply input closes when clicking outside for better UX
  • Unified styling: All comment levels have consistent styling
  • Database migration: Added parent_id column with cascade delete
  • Internationalization: Added translations for all reply-related text (en, ja, zh-CN, zh-TW)
  • Duplicate prevention: Prevents multiple submissions during processing

🛠️ Technical Changes

Backend

  • Added parent_id column to comments table with foreign key and cascade delete
  • Modified comment API to support parentId parameter
  • Enforces two-level nesting (replies to replies go to root comment)
  • Includes replyToUser info in comment response

Frontend

  • Created ReplyInput component for nested replies
  • Created ReplyItem component for rendering second-level comments
  • Added click-outside listeners to close reply inputs
  • Updated CommentItem to support reply functionality
  • Unified comment styling across all levels

Database Migration

  • server/sql/0006.sql: Adds parent_id column with cascade delete

📝 Files Changed

  • server/src/db/schema.ts: Updated comment schema
  • server/src/services/comments.ts: Added reply logic and nested structure building
  • server/sql/0006.sql: Database migration
  • client/src/page/feed.tsx: Added reply UI components
  • client/public/locales/*.json: Added i18n translations
  • server/src/services/feed.ts, rss.ts: Type updates

🔗 Related Issue

Fixes #161


🤖 Generated with Claude Code

@PBnicad PBnicad marked this pull request as draft January 16, 2026 08:31
@PBnicad PBnicad marked this pull request as ready for review January 16, 2026 09:31
@PBnicad PBnicad force-pushed the feature/comment-reply branch from fc02640 to 05e7d49 Compare January 16, 2026 10:02
- Add two-level nesting comment reply functionality
- Add replyToUserId field to track which user is being replied to
- Refresh comments immediately after reply submission
- Add numbering to comments and sort replies chronologically
- Move comment numbering to the left of timestamp
- Add type annotations to sort callback parameters
- Remove unused replyPrefix parameter from CommentItem
- Add database migration for reply functionality
- Update translation files for reply feature

Co-Authored-By: Claude <noreply@anthropic.com>
@PBnicad PBnicad force-pushed the feature/comment-reply branch from 05e7d49 to 3a84800 Compare January 16, 2026 10:04
@OXeu OXeu self-requested a review January 23, 2026 18:09
Copy link
Collaborator

@OXeu OXeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many "any" type annotations in the code. Are they all necessary?

@PBnicad PBnicad force-pushed the feature/comment-reply branch from d56aed9 to ec8cb83 Compare January 24, 2026 15:31
@PBnicad
Copy link
Contributor Author

PBnicad commented Jan 24, 2026

There are too many "any" type annotations in the code. Are they all necessary?代码中"any"类型注解太多。它们都是必要的吗?

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] 评论支持回复

2 participants