Add comment & review system for products & content
This commit implements a full-featured commenting system migrated from remarkbox and adapted for e-commerce use cases.
-
Add comments_enabled (default: true) - master toggle for comment system
-
Add comments_require_purchase (default: false) - restrict to customers only
-
Add comments_require_approval (default: false) - hide until moderator approval
-
Update shop settings UI with three comment control checkboxes
-
Add form handling and success messages for comment settings
-
Create Comment model with nested threading support (parent/child relationships)
-
Link comments to products instead of generic URIs (e-commerce focused)
-
Add approval workflow, soft deletion, and purchase verification
-
Support comment depth calculation and permission checking
-
Add Comment to CLASS_TO_TABLE mapping for mps_comment table creation
-
Create database migration for new shop comment settings columns
-
Create reusable comments snippet for product and content pages
-
Add comment display with nested indentation and approval status
-
Include comment submission form with permission-based visibility
-
Add moderation controls (edit/delete/approve) for shop owners and editors
-
Embed comment system in both product detail and content pages
-
POST /comments/new - Create comments with auto-approval for moderators
-
GET/POST /comments/{id}/edit - Edit comments (owners + moderators)
-
POST /comments/{id}/delete - Soft delete using disable flag
-
POST /comments/{id}/undelete - Restore deleted comments (owners/editors only)
-
POST /comments/{id}/approve - Approve pending comments (moderators)
-
POST /comments/{id}/unapprove - Hide approved comments (moderators)
-
Comment authors can edit/delete their own comments
-
Shop owners have full moderation privileges
-
Shop editors have full moderation privileges
-
Purchase requirement validation when enabled
-
Approval-based visibility filtering
-
Soft deletion using disabled flag and timestamp (like remarkbox)
-
Comments can be restored before cronjob cleanup
-
Compatible with existing disabled node cleanup processes
-
Proper enable/disable methods following remarkbox patterns
-
Avoid circular imports using function-level imports in views
-
Update product and content views to load and pass comment data
-
Maintain remarkbox-style architecture while adapting for e-commerce
-
Remove forum-specific features (voting, thread watching)
-
Focus on product reviews and customer feedback use cases
modified: make_post_sell/models/init.py new file: make_post_sell/models/comment.py modified: make_post_sell/models/meta.py modified: make_post_sell/models/shop.py modified: make_post_sell/routes.py new file: make_post_sell/scripts/alembic/versions/d3e53982070a_add_comment_settings_to_shop.py new file: make_post_sell/templates/comments/edit_comment.j2 new file: make_post_sell/templates/comments/show_comments.j2 modified: make_post_sell/templates/content.j2 modified: make_post_sell/templates/product.j2 modified: make_post_sell/templates/shop_settings.j2 new file: make_post_sell/templates/snippets/comments.j2 new file: make_post_sell/views/comment.py modified: make_post_sell/views/content.py modified: make_post_sell/views/product.py modified: make_post_sell/views/shop.py
Summary by CodeRabbit
-
New Features
- Introduced a full-featured comment and review system for products, supporting threaded replies, editing, soft deletion, moderation (approval/unapproval), and permission controls based on shop settings and user roles.
- Added shop settings to enable/disable comments, require purchase for commenting, and require approval before comments are visible.
- Provided UI for displaying, submitting, editing, replying to, and moderating comments on product and shop pages.
-
Bug Fixes
- Improved email validation in shop user management.
-
Chores
- Database migration to support new shop comment settings.